[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.56 and 1.57

version 1.56, 2013/11/27 13:32:02 version 1.57, 2014/05/20 01:25:23
Line 181 
Line 181 
                 if (stat(*argv, &from_sb))                  if (stat(*argv, &from_sb))
                         err(EX_OSERR, "%s", *argv);                          err(EX_OSERR, "%s", *argv);
                 if (!S_ISREG(to_sb.st_mode))                  if (!S_ISREG(to_sb.st_mode))
                         errx(EX_OSERR, "%s: %s", to_name, strerror(EFTYPE));                          errc(EX_OSERR, EFTYPE, "%s", to_name);
                 if (to_sb.st_dev == from_sb.st_dev &&                  if (to_sb.st_dev == from_sb.st_dev &&
                     to_sb.st_ino == from_sb.st_ino)                      to_sb.st_ino == from_sb.st_ino)
                         errx(EX_USAGE, "%s and %s are the same file", *argv, to_name);                          errx(EX_USAGE, "%s and %s are the same file", *argv, to_name);
Line 211 
Line 211 
                 if (stat(from_name, &from_sb))                  if (stat(from_name, &from_sb))
                         err(EX_OSERR, "%s", from_name);                          err(EX_OSERR, "%s", from_name);
                 if (!S_ISREG(from_sb.st_mode))                  if (!S_ISREG(from_sb.st_mode))
                         errx(EX_OSERR, "%s: %s", from_name, strerror(EFTYPE));                          errc(EX_OSERR, EFTYPE, "%s", from_name);
                 /* Build the target path. */                  /* Build the target path. */
                 if (flags & DIRECTORY) {                  if (flags & DIRECTORY) {
                         (void)snprintf(pathbuf, sizeof(pathbuf), "%s/%s",                          (void)snprintf(pathbuf, sizeof(pathbuf), "%s/%s",
Line 228 
Line 228 
                 /* Only compare against regular files. */                  /* Only compare against regular files. */
                 if (docompare && !S_ISREG(to_sb.st_mode)) {                  if (docompare && !S_ISREG(to_sb.st_mode)) {
                         docompare = 0;                          docompare = 0;
                         warnx("%s: %s", to_name, strerror(EFTYPE));                          warnc(EFTYPE, "%s", to_name);
                 }                  }
         } else if (docompare) {          } else if (docompare) {
                 /* File does not exist so silently ignore compare flag. */                  /* File does not exist so silently ignore compare flag. */
Line 298 
Line 298 
                 if (fstat(temp_fd, &temp_sb)) {                  if (fstat(temp_fd, &temp_sb)) {
                         serrno = errno;                          serrno = errno;
                         (void)unlink(tempfile);                          (void)unlink(tempfile);
                         errx(EX_OSERR, "%s: %s", tempfile, strerror(serrno));                          errc(EX_OSERR, serrno, "%s", tempfile);
                 }                  }
   
                 if (compare(temp_fd, tempfile, (size_t)temp_sb.st_size, to_fd,                  if (compare(temp_fd, tempfile, (size_t)temp_sb.st_size, to_fd,
Line 425 
Line 425 
                     from_fd, (off_t)0)) == MAP_FAILED) {                      from_fd, (off_t)0)) == MAP_FAILED) {
                         serrno = errno;                          serrno = errno;
                         (void)unlink(to_name);                          (void)unlink(to_name);
                         errx(EX_OSERR, "%s: %s", from_name, strerror(serrno));                          errc(EX_OSERR, serrno, "%s", from_name);
                 }                  }
                 madvise(p, size, MADV_SEQUENTIAL);                  madvise(p, size, MADV_SEQUENTIAL);
                 siz = (size_t)size;                  siz = (size_t)size;
Line 467 
Line 467 
                 if (nr != 0) {                  if (nr != 0) {
                         serrno = errno;                          serrno = errno;
                         (void)unlink(to_name);                          (void)unlink(to_name);
                         errx(EX_OSERR, "%s: %s", from_name, strerror(serrno));                          errc(EX_OSERR, serrno, "%s", from_name);
                 }                  }
         }          }
 }  }
Line 542 
Line 542 
         case -1:          case -1:
                 serrno = errno;                  serrno = errno;
                 (void)unlink(to_name);                  (void)unlink(to_name);
                 errx(EX_TEMPFAIL, "forks: %s", strerror(serrno));                  errc(EX_TEMPFAIL, serrno, "forks");
         case 0:          case 0:
                 execl(path_strip, "strip", "--", to_name, (char *)NULL);                  execl(path_strip, "strip", "--", to_name, (char *)NULL);
                 warn("%s", path_strip);                  warn("%s", path_strip);
Line 572 
Line 572 
                                 int mkdir_errno = errno;                                  int mkdir_errno = errno;
                                 if (stat(path, &sb)) {                                  if (stat(path, &sb)) {
                                         /* Not there; use mkdir()s errno */                                          /* Not there; use mkdir()s errno */
                                         errno = mkdir_errno;                                          errc(EX_OSERR, mkdir_errno, "%s",
                                         err(EX_OSERR, "%s", path);                                              path);
                                         /* NOTREACHED */                                          /* NOTREACHED */
                                 }                                  }
                                 if (!S_ISDIR(sb.st_mode)) {                                  if (!S_ISDIR(sb.st_mode)) {
                                         /* Is there, but isn't a directory */                                          /* Is there, but isn't a directory */
                                         errno = ENOTDIR;                                          errc(EX_OSERR, ENOTDIR, "%s", path);
                                         err(EX_OSERR, "%s", path);  
                                         /* NOTREACHED */                                          /* NOTREACHED */
                                 }                                  }
                         }                          }

Legend:
Removed from v.1.56  
changed lines
  Added in v.1.57