[BACK]Return to ttymsg.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / wall

Diff for /src/usr.bin/wall/ttymsg.c between version 1.3 and 1.4

version 1.3, 1996/10/25 06:06:30 version 1.4, 1998/11/18 01:03:16
Line 52 
Line 52 
 #include <stdio.h>  #include <stdio.h>
 #include <string.h>  #include <string.h>
 #include <stdlib.h>  #include <stdlib.h>
   #include <sys/stat.h>
   
 /*  /*
  * Display the contents of a uio structure on a terminal.  Used by wall(1),   * Display the contents of a uio structure on a terminal.  Used by wall(1),
Line 91 
Line 92 
                 return (errbuf);                  return (errbuf);
         }          }
   
           seteuid(geteuid());
   
         /*          /*
          * open will fail on slip lines or exclusive-use lines           * open will fail on slip lines or exclusive-use lines
          * if not running as root; not an error.           * if not running as root; not an error.
          */           */
         if ((fd = open(device, O_WRONLY|O_NONBLOCK, 0)) < 0) {          if ((fd = open(device, O_WRONLY|O_NONBLOCK, 0)) < 0) {
                 if (errno == EBUSY || errno == EACCES)                  if (errno == EBUSY || errno == EACCES) {
                           seteuid(getuid());
                         return (NULL);                          return (NULL);
                   }
                   seteuid(getuid());
                 (void) snprintf(errbuf, sizeof(errbuf),                  (void) snprintf(errbuf, sizeof(errbuf),
                     "%s: %s", device, strerror(errno));                      "%s: %s", device, strerror(errno));
                 return (errbuf);                  return (errbuf);
         }          }
           seteuid(getuid());
   
         for (cnt = left = 0; cnt < iovcnt; ++cnt)          for (cnt = left = 0; cnt < iovcnt; ++cnt)
                 left += iov[cnt].iov_len;                  left += iov[cnt].iov_len;

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4