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

Diff for /src/usr.bin/calendar/io.c between version 1.46 and 1.50

version 1.46, 2017/08/21 21:41:13 version 1.50, 2021/10/24 21:24:16
Line 326 
Line 326 
                         if (!(chdir(home) == 0 &&                          if (!(chdir(home) == 0 &&
                             chdir(calendarHome) == 0 &&                              chdir(calendarHome) == 0 &&
                             (fdin = open(calendarFile, O_RDONLY)) != -1))                              (fdin = open(calendarFile, O_RDONLY)) != -1))
                                 errx(1, "no calendar file: ``%s'' or ``~/%s/%s''",                                  errx(1, "no calendar file: \"%s\" or \"~/%s/%s\"",
                                     calendarFile, calendarHome, calendarFile);                                      calendarFile, calendarHome, calendarFile);
                 }                  }
         }          }
   
         if (pipe(pdes) < 0) {          if (pipe(pdes) == -1) {
                 close(fdin);                  close(fdin);
                 return (NULL);                  return (NULL);
         }          }
Line 355 
Line 355 
                  */                   */
                 if (doall) {                  if (doall) {
                         int fderr;                          int fderr;
                         fderr = open(_PATH_DEVNULL, O_WRONLY, 0);                          fderr = open(_PATH_DEVNULL, O_WRONLY);
                         if (fderr == -1)                          if (fderr == -1)
                                 _exit(0);                                  _exit(0);
                         (void)dup2(fderr, STDERR_FILENO);                          (void)dup2(fderr, STDERR_FILENO);
Line 385 
Line 385 
         struct stat sbuf;          struct stat sbuf;
         int nread, pdes[2], status;          int nread, pdes[2], status;
         char buf[1024];          char buf[1024];
         pid_t pid;          pid_t pid = -1;
   
         if (!doall)          if (!doall)
                 return;                  return;
Line 393 
Line 393 
         (void)rewind(fp);          (void)rewind(fp);
         if (fstat(fileno(fp), &sbuf) || !sbuf.st_size)          if (fstat(fileno(fp), &sbuf) || !sbuf.st_size)
                 goto done;                  goto done;
         if (pipe(pdes) < 0)          if (pipe(pdes) == -1)
                 goto done;                  goto done;
         switch ((pid = vfork())) {          switch ((pid = vfork())) {
         case -1:                        /* error */          case -1:                        /* error */
Line 422 
Line 422 
                 (void)write(pdes[1], buf, nread);                  (void)write(pdes[1], buf, nread);
         (void)close(pdes[1]);          (void)close(pdes[1]);
 done:   (void)fclose(fp);  done:   (void)fclose(fp);
         while (waitpid(pid, &status, 0) == -1) {          if (pid != -1) {
                 if (errno != EINTR)                  while (waitpid(pid, &status, 0) == -1) {
                         break;                          if (errno != EINTR)
                                   break;
                   }
         }          }
 }  }
   

Legend:
Removed from v.1.46  
changed lines
  Added in v.1.50