summaryrefslogtreecommitdiff
path: root/sbin/ttyflags/ttyflags.c
diff options
context:
space:
mode:
authorThorsten Lockert <tholo@cvs.openbsd.org>1997-03-04 05:48:01 +0000
committerThorsten Lockert <tholo@cvs.openbsd.org>1997-03-04 05:48:01 +0000
commitd2a34602284be31da15078ee1e3e841ad741743e (patch)
treef48b1f726b9f04e6f7e62a1c40bc84879e11cd6b /sbin/ttyflags/ttyflags.c
parentf66c4325e92d8821b8f28ff4a2069110d7dcdc27 (diff)
Initialize path earlier so we never try to use it before it has been
initialized; from Time Pierce <twpierce@mail.bsd.uchicago.edu>
Diffstat (limited to 'sbin/ttyflags/ttyflags.c')
-rw-r--r--sbin/ttyflags/ttyflags.c12
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) {