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

Diff for /src/usr.bin/wall/wall.c between version 1.12 and 1.13

version 1.12, 1999/05/30 08:21:15 version 1.13, 2000/09/07 17:23:26
Line 134 
Line 134 
         makemsg(*argv);          makemsg(*argv);
   
         if (!(fp = fopen(_PATH_UTMP, "r")))          if (!(fp = fopen(_PATH_UTMP, "r")))
                 errx(1, "cannot read %s.\n", _PATH_UTMP);                  errx(1, "cannot read %s.", _PATH_UTMP);
         iov.iov_base = mbuf;          iov.iov_base = mbuf;
         iov.iov_len = mbufsize;          iov.iov_len = mbufsize;
         /* NOSTRICT */          /* NOSTRICT */
Line 169 
Line 169 
                 strncpy(line, utmp.ut_line, sizeof(utmp.ut_line));                  strncpy(line, utmp.ut_line, sizeof(utmp.ut_line));
                 line[sizeof(utmp.ut_line)] = '\0';                  line[sizeof(utmp.ut_line)] = '\0';
                 if ((p = ttymsg(&iov, 1, line, 60*5)) != NULL)                  if ((p = ttymsg(&iov, 1, line, 60*5)) != NULL)
                         warnx("%s\n", p);                          warnx("%s", p);
         }          }
         exit(0);          exit(0);
 }  }
Line 191 
Line 191 
   
         snprintf(tmpname, sizeof(tmpname), "%s/wall.XXXXXX", _PATH_TMP);          snprintf(tmpname, sizeof(tmpname), "%s/wall.XXXXXX", _PATH_TMP);
         if ((fd = mkstemp(tmpname)) == -1 || !(fp = fdopen(fd, "r+")))          if ((fd = mkstemp(tmpname)) == -1 || !(fp = fdopen(fd, "r+")))
                 errx(1, "can't open temporary file.\n");                  errx(1, "can't open temporary file.");
         (void)unlink(tmpname);          (void)unlink(tmpname);
   
         if (!nobanner) {          if (!nobanner) {
Line 221 
Line 221 
         }          }
         (void)fprintf(fp, "%79s\r\n", " ");          (void)fprintf(fp, "%79s\r\n", " ");
   
         if (fname && !(freopen(fname, "r", stdin)))          if (fname) {
                 errx(1, "can't read %s.\n", fname);                  gid_t egid = getegid();
   
                   setegid(getgid());
                   if (freopen(fname, "r", stdin) == NULL)
                           errx(1, "can't read %s.", fname);
                   setegid(egid);
           }
         while (fgets(lbuf, sizeof(lbuf), stdin))          while (fgets(lbuf, sizeof(lbuf), stdin))
                 for (cnt = 0, p = lbuf; (ch = *p) != '\0'; ++p, ++cnt) {                  for (cnt = 0, p = lbuf; (ch = *p) != '\0'; ++p, ++cnt) {
                         vis(tmpbuf, ch, VIS_SAFE|VIS_NOSLASH, p[1]);                          vis(tmpbuf, ch, VIS_SAFE|VIS_NOSLASH, p[1]);
Line 244 
Line 250 
         rewind(fp);          rewind(fp);
   
         if (fstat(fd, &sbuf))          if (fstat(fd, &sbuf))
                 errx(1, "can't stat temporary file.\n");                  errx(1, "can't stat temporary file.");
         mbufsize = sbuf.st_size;          mbufsize = sbuf.st_size;
         if (!(mbuf = malloc((u_int)mbufsize)))          if (!(mbuf = malloc((u_int)mbufsize)))
                 errx(1, "out of memory.\n");                  errx(1, "out of memory.");
         if (fread(mbuf, sizeof(*mbuf), mbufsize, fp) != mbufsize)          if (fread(mbuf, sizeof(*mbuf), mbufsize, fp) != mbufsize)
                 errx(1, "can't read temporary file.\n");                  errx(1, "can't read temporary file.");
         (void)close(fd);          (void)close(fd);
 }  }

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.13