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

Diff for /src/usr.bin/mail/fio.c between version 1.17 and 1.18

version 1.17, 2000/08/02 04:10:48 version 1.18, 2001/01/16 05:36:08
Line 58 
Line 58 
  */   */
   
 /*  /*
    * Wrapper for read() to catch EINTR.
    */
   ssize_t
   myread(fd, buf, len)
           int fd;
           char *buf;
           int len;
   {
           ssize_t nread;
   
           while ((nread = read(fd, buf, len)) == -1 && errno == EINTR)
                   ;
           return(nread);
   }
   
   /*
  * Set up the input pointers while copying the mail file into /tmp.   * Set up the input pointers while copying the mail file into /tmp.
  */   */
 void  void
Line 251 
Line 267 
         size -= (omsgCount + 1) * sizeof(struct message);          size -= (omsgCount + 1) * sizeof(struct message);
         fflush(f);          fflush(f);
         (void)lseek(fileno(f), (off_t)sizeof(*message), 0);          (void)lseek(fileno(f), (off_t)sizeof(*message), 0);
         if (read(fileno(f), (void *) &message[omsgCount], size) != size)          if (myread(fileno(f), (void *) &message[omsgCount], size) != size)
                 errx(1, "Message temporary file corrupted");                  errx(1, "Message temporary file corrupted");
         message[msgCount].m_size = 0;          message[msgCount].m_size = 0;
         message[msgCount].m_lines = 0;          message[msgCount].m_lines = 0;
Line 400 
Line 416 
                 return(name);                  return(name);
         }          }
         (void)snprintf(cmdbuf, sizeof(cmdbuf), "echo %s", name);          (void)snprintf(cmdbuf, sizeof(cmdbuf), "echo %s", name);
         if ((shell = value("SHELL")) == NULL)          shell = value("SHELL");
                 shell = _PATH_CSHELL;  
         pid = start_command(shell, 0, -1, pivec[1], "-c", cmdbuf, NULL);          pid = start_command(shell, 0, -1, pivec[1], "-c", cmdbuf, NULL);
         if (pid < 0) {          if (pid < 0) {
                 (void)close(pivec[0]);                  (void)close(pivec[0]);
Line 409 
Line 424 
                 return(NULL);                  return(NULL);
         }          }
         (void)close(pivec[1]);          (void)close(pivec[1]);
         l = read(pivec[0], xname, PATHSIZE);          l = myread(pivec[0], xname, PATHSIZE);
           if (l < 0)
                   warn("read"); /* report error before errno changes */
         (void)close(pivec[0]);          (void)close(pivec[0]);
         if (wait_child(pid) < 0 && WIFSIGNALED(wait_status) &&          if (wait_child(pid) < 0 && WIFSIGNALED(wait_status) &&
             WTERMSIG(wait_status) != SIGPIPE) {              WTERMSIG(wait_status) != SIGPIPE) {
                 fprintf(stderr, "\"%s\": Expansion failed.\n", name);                  fprintf(stderr, "\"%s\": Expansion failed.\n", name);
                 return(NULL);                  return(NULL);
         }          }
         if (l < 0) {          if (l < 0)
                 warn("read");  
                 return(NULL);                  return(NULL);
         }  
         if (l == 0) {          if (l == 0) {
                 fprintf(stderr, "\"%s\": No match.\n", name);                  fprintf(stderr, "\"%s\": No match.\n", name);
                 return(NULL);                  return(NULL);

Legend:
Removed from v.1.17  
changed lines
  Added in v.1.18