summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gnu/usr.bin/sudo/sudo/sudo.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/gnu/usr.bin/sudo/sudo/sudo.c b/gnu/usr.bin/sudo/sudo/sudo.c
index c72c49d1674..dd272cc85ba 100644
--- a/gnu/usr.bin/sudo/sudo/sudo.c
+++ b/gnu/usr.bin/sudo/sudo/sudo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sudo.c,v 1.5 1997/11/23 07:15:49 millert Exp $ */
+/* $OpenBSD: sudo.c,v 1.6 1997/12/21 23:15:06 millert Exp $ */
/*
* CU sudo version 1.5.3 (based on Root Group sudo version 1.1)
@@ -435,10 +435,10 @@ static void load_globals(sudo_mode)
/*
* Need to get tty early since it's used for logging
*/
- if ((tty = (char *) ttyname(0)) || (tty = (char *) ttyname(1))) {
- if (strncmp(tty, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0)
- tty += sizeof(_PATH_DEV) - 1;
- if ((tty = (char *) strdup(tty)) == NULL) {
+ if ((p = (char *) ttyname(0)) || (p = (char *) ttyname(1))) {
+ if (strncmp(p, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0)
+ p += sizeof(_PATH_DEV) - 1;
+ if ((tty = (char *) strdup(p)) == NULL) {
perror("malloc");
(void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]);
exit(1);