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

Diff for /src/usr.bin/write/write.c between version 1.31 and 1.32

version 1.31, 2015/10/09 01:37:09 version 1.32, 2015/10/20 20:21:18
Line 228 
Line 228 
         time_t now;          time_t now;
         char path[PATH_MAX], host[HOST_NAME_MAX+1], line[512];          char path[PATH_MAX], host[HOST_NAME_MAX+1], line[512];
         gid_t gid;          gid_t gid;
           int fd;
   
         /* Determine our login name before the we reopen() stdout */          /* Determine our login name before the we reopen() stdout */
         if ((login = getlogin()) == NULL) {          if ((login = getlogin()) == NULL) {
Line 238 
Line 239 
         }          }
   
         (void)snprintf(path, sizeof(path), "%s%s", _PATH_DEV, tty);          (void)snprintf(path, sizeof(path), "%s%s", _PATH_DEV, tty);
         if ((freopen(path, "r+", stdout)) == NULL)          fd = open(path, O_WRONLY, 0666);
                 err(1, "%s", path);          if (fd == -1)
                   err(1, "open %s", path);
           fflush(stdout);
           if (dup2(fd, STDOUT_FILENO) == -1)
                   err(1, "dup2 %s", path);
           if (fd != STDOUT_FILENO)
                   close(fd);
   
         /* revoke privs, now that we have opened the tty */          /* revoke privs, now that we have opened the tty */
         gid = getgid();          gid = getgid();

Legend:
Removed from v.1.31  
changed lines
  Added in v.1.32