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

Diff for /src/usr.bin/which/which.c between version 1.3 and 1.4

version 1.3, 1998/01/28 17:18:53 version 1.4, 1998/05/07 19:12:20
Line 100 
Line 100 
                 mib[0] = CTL_USER;                  mib[0] = CTL_USER;
                 mib[1] = USER_CS_PATH;                  mib[1] = USER_CS_PATH;
                 if (sysctl(mib, 2, NULL, &n, NULL, 0) == -1)                  if (sysctl(mib, 2, NULL, &n, NULL, 0) == -1)
                         err(-1, "unable to get length of user.cs_path");                          err(1, "unable to get length of user.cs_path");
                 if (n == 0)                  if (n == 0)
                         errx(-1, "user.cs_path was zero length!");                          errx(1, "user.cs_path was zero length!");
                 if ((path = (char *)malloc(n)) == NULL)                  if ((path = (char *)malloc(n)) == NULL)
                         errx(-1, "can't allocate memory.");                          errx(1, "can't allocate memory.");
                 if (sysctl(mib, 2, path, &n, NULL, 0) == -1)                  if (sysctl(mib, 2, path, &n, NULL, 0) == -1)
                         err(-1, "unable to get user.cs_path");                          err(1, "unable to get user.cs_path");
         } else {          } else {
                 if ((path = getenv("PATH")) == NULL)                  if ((path = getenv("PATH")) == NULL)
                         err(-1, "can't get $PATH from environment");                          err(1, "can't get $PATH from environment");
         }          }
   
         /* To make access(2) do what we want */          /* To make access(2) do what we want */
         if (setgid(getegid()))          if (setgid(getegid()))
                 err(-1, "Can't set gid to %u", getegid());                  err(1, "Can't set gid to %u", getegid());
         if (setuid(geteuid()))          if (setuid(geteuid()))
                 err(-1, "Can't set uid to %u", geteuid());                  err(1, "Can't set uid to %u", geteuid());
   
         for (n = optind; n < argc; n++)          for (n = optind; n < argc; n++)
                 if (findprog(argv[n], path, progmode, allmatches) == 0)                  if (findprog(argv[n], path, progmode, allmatches) == 0)
Line 149 
Line 149 
         }          }
   
         if ((path = strdup(path)) == NULL)          if ((path = strdup(path)) == NULL)
                 errx(-1, "Can't allocate memory.");                  errx(1, "Can't allocate memory.");
   
         proglen = strlen(prog);          proglen = strlen(prog);
         while ((p = strsep(&path, ":")) != NULL) {          while ((p = strsep(&path, ":")) != NULL) {

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4