]> Zhao Yanbai Git Server - minix.git/commitdiff
init: handle getty string of "" (default) 27/627/2
authorBen Gras <ben@minix3.org>
Tue, 11 Jun 2013 14:30:31 +0000 (14:30 +0000)
committerBen Gras <ben@minix3.org>
Wed, 12 Jun 2013 07:04:53 +0000 (07:04 +0000)
. the default entry for disabled ttys for getty
  in /etc/ttys is "", but init crashed on handling that
  string.

Change-Id: Ib7cd6c6869e338f47df0aa5abed36f15eda4f6ff

servers/init/init.c

index 4fc9bec45a6122f0c289e4be5964b3a2f8d4c150..abfe038d37a04bfefc6c9d76aa5941bcfe718b72 100644 (file)
@@ -263,15 +263,16 @@ void startup(int linenr, struct ttyent *ttyp)
 
        /* Construct argv for execute() */
        ty_getty_argv = construct_argv(ttyp->ty_getty);
-       if (ty_getty_argv == NULL)
+       if (ty_getty_argv == NULL) {
                report(2, "construct_argv");
-
-       /* Execute the getty process. */
-       execute(ty_getty_argv);
+       } else {
+               /* Execute the getty process. */
+               execute(ty_getty_argv);
+       }
 
        /* Oops, disaster strikes. */
        fcntl(2, F_SETFL, fcntl(2, F_GETFL) | O_NONBLOCK);
-       if (linenr != 0) report(2, ty_getty_argv[0]);
+       if (linenr != 0 && ty_getty_argv) report(2, ty_getty_argv[0]);
        write(err[1], &errno, sizeof(errno));
        _exit(1);
   }