2014-02-03 17:17:17 +01:00
|
|
|
--- term-utils/agetty.c
|
2014-02-04 09:50:39 +01:00
|
|
|
+++ term-utils/agetty.c 2014-02-04 08:50:09.798235374 +0000
|
2014-02-03 17:17:17 +01:00
|
|
|
@@ -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 {
|
2014-02-04 09:50:39 +01:00
|
|
|
@@ -745,8 +746,16 @@ static void parse_args(int argc, char **
|
2014-02-03 17:17:17 +01:00
|
|
|
usage(stderr);
|
|
|
|
}
|
|
|
|
|
2014-02-04 09:50:39 +01:00
|
|
|
+ c = asprintf(&ptr, "/dev/%s", argv[optind]);
|
2014-02-03 17:17:17 +01:00
|
|
|
+ if (c < 0)
|
|
|
|
+ log_err(_("failed to allocate memory: %m"));
|
2014-02-04 09:50:39 +01:00
|
|
|
+
|
|
|
|
+ c = access(ptr, F_OK);
|
|
|
|
+ free(ptr);
|
|
|
|
+ errno = 0;
|
2014-02-03 17:17:17 +01:00
|
|
|
+
|
|
|
|
/* Accept "tty", "baudrate tty", and "tty baudrate". */
|
|
|
|
- if ('0' <= argv[optind][0] && argv[optind][0] <= '9') {
|
2014-02-04 09:50:39 +01:00
|
|
|
+ if (c < 0) {
|
2014-02-03 17:17:17 +01:00
|
|
|
/* Assume BSD style speed. */
|
|
|
|
parse_speeds(op, argv[optind++]);
|
|
|
|
if (argc < optind + 1) {
|