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

Diff for /src/usr.bin/xinstall/xinstall.c between version 1.72 and 1.73

version 1.72, 2019/05/09 22:44:53 version 1.73, 2019/06/28 13:35:05
Line 256 
Line 256 
         }          }
   
         if (!devnull) {          if (!devnull) {
                 if ((from_fd = open(from_name, O_RDONLY, 0)) < 0)                  if ((from_fd = open(from_name, O_RDONLY, 0)) == -1)
                         err(1, "%s", from_name);                          err(1, "%s", from_name);
         }          }
   
Line 276 
Line 276 
                  *  that does not work in-place -- like gnu binutils strip.                   *  that does not work in-place -- like gnu binutils strip.
                  */                   */
                 close(to_fd);                  close(to_fd);
                 if ((to_fd = open(tempfile, O_RDONLY, 0)) < 0)                  if ((to_fd = open(tempfile, O_RDONLY, 0)) == -1)
                         err(1, "stripping %s", to_name);                          err(1, "stripping %s", to_name);
         }          }
   
Line 288 
Line 288 
                 struct stat temp_sb;                  struct stat temp_sb;
   
                 /* Re-open to_fd using the real target name. */                  /* Re-open to_fd using the real target name. */
                 if ((to_fd = open(to_name, O_RDONLY, 0)) < 0)                  if ((to_fd = open(to_name, O_RDONLY, 0)) == -1)
                         err(1, "%s", to_name);                          err(1, "%s", to_name);
   
                 if (fstat(temp_fd, &temp_sb)) {                  if (fstat(temp_fd, &temp_sb)) {
Line 377 
Line 377 
                         (void)snprintf(backup, PATH_MAX, "%s%s", to_name,                          (void)snprintf(backup, PATH_MAX, "%s%s", to_name,
                             suffix);                              suffix);
                         /* It is ok for the target file not to exist. */                          /* It is ok for the target file not to exist. */
                         if (rename(to_name, backup) < 0 && errno != ENOENT) {                          if (rename(to_name, backup) == -1 && errno != ENOENT) {
                                 serrno = errno;                                  serrno = errno;
                                 unlink(tempfile);                                  unlink(tempfile);
                                 errx(1, "rename: %s to %s: %s", to_name,                                  errx(1, "rename: %s to %s: %s", to_name,
                                      backup, strerror(serrno));                                       backup, strerror(serrno));
                         }                          }
                 }                  }
                 if (rename(tempfile, to_name) < 0 ) {                  if (rename(tempfile, to_name) == -1 ) {
                         serrno = errno;                          serrno = errno;
                         unlink(tempfile);                          unlink(tempfile);
                         errx(1, "rename: %s to %s: %s", tempfile,                          errx(1, "rename: %s to %s: %s", tempfile,
Line 726 
Line 726 
                                 /*                                  /*
                                  * skip, buf is empty so far                                   * skip, buf is empty so far
                                  */                                   */
                                 if (lseek(fd, (off_t)wcnt, SEEK_CUR) < 0) {                                  if (lseek(fd, (off_t)wcnt, SEEK_CUR) == -1) {
                                         warn("lseek");                                          warn("lseek");
                                         return(-1);                                          return(-1);
                                 }                                  }
Line 772 
Line 772 
         /*          /*
          * move back one byte and write a zero           * move back one byte and write a zero
          */           */
         if (lseek(fd, (off_t)-1, SEEK_CUR) < 0) {          if (lseek(fd, (off_t)-1, SEEK_CUR) == -1) {
                 warn("Failed seek on file");                  warn("Failed seek on file");
                 return;                  return;
         }          }
   
         if (write(fd, blnk, 1) < 0)          if (write(fd, blnk, 1) == -1)
                 warn("Failed write to file");                  warn("Failed write to file");
         return;          return;
 }  }

Legend:
Removed from v.1.72  
changed lines
  Added in v.1.73