]> granicus.if.org Git - sudo/commitdiff
now only strip '/dev/' off of a tty if it starts with '/dev/'
authorTodd C. Miller <Todd.Miller@courtesan.com>
Sun, 3 Sep 1995 18:12:24 +0000 (18:12 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Sun, 3 Sep 1995 18:12:24 +0000 (18:12 +0000)
sudo.c

diff --git a/sudo.c b/sudo.c
index b185bb7bb65098c3adf7dbf848961eedf42d129b..2c538bc25e8dedab23fff133905021931d9c4e5d 100644 (file)
--- a/sudo.c
+++ b/sudo.c
@@ -372,8 +372,8 @@ 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(0))) {
-       if ((p = strrchr(tty, '/')))
-           tty = p + 1;
+       if (strncmp(tty, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0)
+           tty += sizeof(_PATH_DEV) - 1;
        if ((tty = strdup(tty)) == NULL) {
            perror("malloc");
            (void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]);