diff options
author | Miles Bader <miles@gnu.org> | 1996-06-21 21:05:21 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 1996-06-21 21:05:21 +0000 |
commit | 90c65e9c74865a9ed821841190356fa9398fec73 (patch) | |
tree | f17d9360868d47f56c45f4cf2a5bb53edc8fa298 | |
parent | 739183d118aff3fabe0bd2992dc1843b0e655f97 (diff) |
(open_console):
Print an error messages for /dev/console not being a terminal.
Reduce the scope of some variables.
-rw-r--r-- | init/init.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/init/init.c b/init/init.c index e26fa535..e85c1e1a 100644 --- a/init/init.c +++ b/init/init.c @@ -935,12 +935,8 @@ open_console () { #define TERMINAL_FIRST_TRY "/hurd/term\0/tmp/console\0device\0console" #define TERMINAL_SECOND_TRY "/hurd/term\0/tmp\0device\0console" - static char *terminal; - int try; - size_t argz_len; mach_port_t term; static char *termname; - int fd; struct stat st; error_t err = 0; @@ -958,12 +954,17 @@ open_console () err = errno; if (err) error (0, err, "%s", termname); + else if (st.st_fstype != FSTYPE_TERM) + error (0, 0, "%s: Not a terminal", termname); - try = 1; if (term == MACH_PORT_NULL || err || st.st_fstype != FSTYPE_TERM) /* Start the terminal server ourselves. */ { + size_t argz_len; /* Length of args passed to translator. */ + char *terminal; /* Name of term translator. */ mach_port_t control; /* Control port for term translator. */ + int try = 1; + error_t open_node (int flags, mach_port_t *underlying, mach_msg_type_name_t *underlying_type) @@ -1052,7 +1053,7 @@ open_console () Otherwise, open fd's 0, 1, and 2. */ if (term != MACH_PORT_NULL) { - fd = openport (term, O_RDWR); + int fd = openport (term, O_RDWR); if (fd < 0) assert_perror (errno); |