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

Diff for /src/usr.bin/patch/util.c between version 1.44 and 1.45

version 1.44, 2019/08/17 14:25:06 version 1.45, 2019/12/02 22:17:32
Line 61 
Line 61 
                 fromfd = open(from, O_RDONLY);                  fromfd = open(from, O_RDONLY);
                 if (fromfd == -1)                  if (fromfd == -1)
                         pfatal("internal error, can't reopen %s", from);                          pfatal("internal error, can't reopen %s", from);
                 while ((i = read(fromfd, buf, sizeof buf)) > 0)                  while ((i = read(fromfd, buf, bufsz)) > 0)
                         if (write(STDOUT_FILENO, buf, i) != i)                          if (write(STDOUT_FILENO, buf, i) != i)
                                 pfatal("write failed");                                  pfatal("write failed");
                 close(fromfd);                  close(fromfd);
Line 160 
Line 160 
         fromfd = open(from, O_RDONLY, 0);          fromfd = open(from, O_RDONLY, 0);
         if (fromfd == -1)          if (fromfd == -1)
                 pfatal("internal error, can't reopen %s", from);                  pfatal("internal error, can't reopen %s", from);
         while ((i = read(fromfd, buf, sizeof buf)) > 0)          while ((i = read(fromfd, buf, bufsz)) > 0)
                 if (write(tofd, buf, i) != i)                  if (write(tofd, buf, i) != i)
                         pfatal("write to %s failed", to);                          pfatal("write to %s failed", to);
         close(fromfd);          close(fromfd);
Line 267 
Line 267 
         if (ttyfd < 0)          if (ttyfd < 0)
                 ttyfd = open(_PATH_TTY, O_RDONLY);                  ttyfd = open(_PATH_TTY, O_RDONLY);
         if (ttyfd >= 0) {          if (ttyfd >= 0) {
                 if ((nr = read(ttyfd, buf, sizeof(buf))) > 0 &&                  if ((nr = read(ttyfd, buf, bufsz)) > 0 &&
                     buf[nr - 1] == '\n')                      buf[nr - 1] == '\n')
                         buf[nr - 1] = '\0';                          buf[nr - 1] = '\0';
         }          }

Legend:
Removed from v.1.44  
changed lines
  Added in v.1.45