diff options
author | 1997-03-04 05:48:00 +0000 | |
---|---|---|
committer | 1997-03-04 05:48:00 +0000 | |
commit | c8b721548cf2839ecb198b59e408bfe88e92493d (patch) | |
tree | 45c6af4aa530ba28547af516636d796d424d58fa | |
parent | Do not post-process directories in cpio mode (diff) | |
download | wireguard-openbsd-c8b721548cf2839ecb198b59e408bfe88e92493d.tar.xz wireguard-openbsd-c8b721548cf2839ecb198b59e408bfe88e92493d.zip |
Initialize path earlier so we never try to use it before it has been
initialized; from Time Pierce <twpierce@mail.bsd.uchicago.edu>
-rw-r--r-- | sbin/ttyflags/ttyflags.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/sbin/ttyflags/ttyflags.c b/sbin/ttyflags/ttyflags.c index 9ea77dcf18b..ade502488ee 100644 --- a/sbin/ttyflags/ttyflags.c +++ b/sbin/ttyflags/ttyflags.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ttyflags.c,v 1.6 1997/01/15 23:41:44 millert Exp $ */ +/* $OpenBSD: ttyflags.c,v 1.7 1997/03/04 05:48:00 tholo Exp $ */ /* $NetBSD: ttyflags.c,v 1.8 1996/04/09 05:20:30 cgd Exp $ */ /* @@ -39,7 +39,7 @@ char copyright[] = #endif /* not lint */ #ifndef lint -static char rcsid[] = "$OpenBSD: ttyflags.c,v 1.6 1997/01/15 23:41:44 millert Exp $"; +static char rcsid[] = "$OpenBSD: ttyflags.c,v 1.7 1997/03/04 05:48:00 tholo Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -176,6 +176,9 @@ ttyflags(tep, print) st = tep->ty_status; strflags[0] = '\0'; + /* Find the full device path name. */ + (void)snprintf(path, sizeof path, "%s%s", _PATH_DEV, tep->ty_name); + if (print == 0) { /* Convert ttyent.h flags into ioctl flags. */ if (st & TTY_LOCAL) { @@ -205,9 +208,6 @@ ttyflags(tep, print) printf("%s setting flags to: %s\n", path, strflags); } - /* Find the full device path name. */ - (void)snprintf(path, sizeof path, "%s%s", _PATH_DEV, tep->ty_name); - if (nflag) return (0); @@ -229,7 +229,7 @@ ttyflags(tep, print) } else { if (ioctl(fd, TIOCGFLAGS, &flags) == -1) if (errno != ENOTTY || vflag) { - warn("TIOCSFLAGS on %s", path); + warn("TIOCGFLAGS on %s", path); rval = (errno != ENOTTY); } if (flags & TIOCFLAG_CLOCAL) { |