From 3a4700cd3386413f4a238b22b1830dab18bed0467d3b5ce091a1bb90e1088e3f Mon Sep 17 00:00:00 2001 From: "Dr. Werner Fink" Date: Tue, 4 Feb 2014 08:50:39 +0000 Subject: [PATCH] . OBS-URL: https://build.opensuse.org/package/show/Base:System/util-linux?expand=0&rev=210 --- agetty-on-s390-on-dev--3270-tty1-line.patch | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/agetty-on-s390-on-dev--3270-tty1-line.patch b/agetty-on-s390-on-dev--3270-tty1-line.patch index ac8c4d1..b8ac68a 100644 --- a/agetty-on-s390-on-dev--3270-tty1-line.patch +++ b/agetty-on-s390-on-dev--3270-tty1-line.patch @@ -1,5 +1,5 @@ --- term-utils/agetty.c -+++ term-utils/agetty.c 2014-02-03 16:08:55.446235045 +0000 ++++ term-utils/agetty.c 2014-02-04 08:50:09.798235374 +0000 @@ -571,6 +571,7 @@ static void login_options_to_argv(char * /* Parse command-line arguments. */ static void parse_args(int argc, char **argv, struct options *op) @@ -8,26 +8,21 @@ int c; enum { -@@ -745,8 +746,13 @@ static void parse_args(int argc, char ** +@@ -745,8 +746,16 @@ static void parse_args(int argc, char ** usage(stderr); } -+ c = asprintf(ptr, "/dev/%s", argv[optind]); ++ c = asprintf(&ptr, "/dev/%s", argv[optind]); + if (c < 0) + log_err(_("failed to allocate memory: %m")); ++ ++ c = access(ptr, F_OK); ++ free(ptr); ++ errno = 0; + /* Accept "tty", "baudrate tty", and "tty baudrate". */ - if ('0' <= argv[optind][0] && argv[optind][0] <= '9') { -+ if (access(ptr, F_OK) < 0) { -+ errno = 0; ++ if (c < 0) { /* Assume BSD style speed. */ parse_speeds(op, argv[optind++]); if (argc < optind + 1) { -@@ -764,6 +770,7 @@ static void parse_args(int argc, char ** - op->speeds[op->numspeed++] = bcode("9600"); - } - } -+ free(ptr); - - /* On virtual console remember the line which is used for */ - if (strncmp(op->tty, "tty", 3) == 0 &&