[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.66 and 1.67

version 1.66, 2017/08/21 21:41:13 version 1.67, 2018/09/16 02:44:07
Line 60 
Line 60 
 #define NOCHANGEBITS    (UF_IMMUTABLE | UF_APPEND | SF_IMMUTABLE | SF_APPEND)  #define NOCHANGEBITS    (UF_IMMUTABLE | UF_APPEND | SF_IMMUTABLE | SF_APPEND)
 #define BACKUP_SUFFIX   ".old"  #define BACKUP_SUFFIX   ".old"
   
 struct passwd *pp;  
 struct group *gp;  
 int dobackup, docompare, dodest, dodir, dopreserve, dostrip, safecopy;  int dobackup, docompare, dodest, dodir, dopreserve, dostrip, safecopy;
 int mode = S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH;  int mode = S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH;
 char pathbuf[PATH_MAX], tempfile[PATH_MAX];  char pathbuf[PATH_MAX], tempfile[PATH_MAX];
 char *suffix = BACKUP_SUFFIX;  char *suffix = BACKUP_SUFFIX;
 uid_t uid;  uid_t uid = (uid_t)-1;
 gid_t gid;  gid_t gid = (gid_t)-1;
   
 void    copy(int, char *, int, char *, off_t, int);  void    copy(int, char *, int, char *, off_t, int);
 int     compare(int, const char *, off_t, int, const char *, off_t);  int     compare(int, const char *, off_t, int, const char *, off_t);
Line 89 
Line 87 
         u_int iflags;          u_int iflags;
         int ch, no_target;          int ch, no_target;
         char *flags, *to_name, *group = NULL, *owner = NULL;          char *flags, *to_name, *group = NULL, *owner = NULL;
           const char *errstr;
   
         iflags = 0;          iflags = 0;
         while ((ch = getopt(argc, argv, "B:bCcDdFf:g:m:o:pSs")) != -1)          while ((ch = getopt(argc, argv, "B:bCcDdFf:g:m:o:pSs")) != -1)
Line 161 
Line 160 
                 safecopy = 1;                  safecopy = 1;
   
         /* get group and owner id's */          /* get group and owner id's */
         if (group && !(gp = getgrnam(group)) && !isdigit((unsigned char)*group))          if (group != NULL && gid_from_group(group, &gid) == -1) {
                 errx(1, "unknown group %s", group);                  gid = strtonum(group, 0, GID_MAX, &errstr);
         gid = (group) ? ((gp) ? gp->gr_gid : (gid_t)strtoul(group, NULL, 10)) : (gid_t)-1;                  if (errstr != NULL)
         if (owner && !(pp = getpwnam(owner)) && !isdigit((unsigned char)*owner))                          errx(1, "unknown group %s", group);
                 errx(1, "unknown user %s", owner);          }
         uid = (owner) ? ((pp) ? pp->pw_uid : (uid_t)strtoul(owner, NULL, 10)) : (uid_t)-1;          if (owner != NULL && uid_from_user(owner, &uid) == -1) {
                   uid = strtonum(owner, 0, UID_MAX, &errstr);
                   if (errstr != NULL)
                           errx(1, "unknown user %s", owner);
           }
   
         if (dodir) {          if (dodir) {
                 for (; *argv != NULL; ++argv)                  for (; *argv != NULL; ++argv)

Legend:
Removed from v.1.66  
changed lines
  Added in v.1.67