1
0
forked from pool/util-linux
util-linux/agetty-on-s390-on-dev--3270-tty1-line.patch

34 lines
977 B
Diff
Raw Normal View History

--- term-utils/agetty.c
+++ term-utils/agetty.c 2014-02-03 16:08:55.446235045 +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)
{
+ char *ptr;
int c;
enum {
@@ -745,8 +746,13 @@ static void parse_args(int argc, char **
usage(stderr);
}
+ c = asprintf(ptr, "/dev/%s", argv[optind]);
+ if (c < 0)
+ log_err(_("failed to allocate memory: %m"));
+
/* Accept "tty", "baudrate tty", and "tty baudrate". */
- if ('0' <= argv[optind][0] && argv[optind][0] <= '9') {
+ if (access(ptr, F_OK) < 0) {
+ errno = 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 &&