mirror of
https://github.com/mirror/make.git
synced 2025-01-30 14:20:14 +08:00
(search_path): Function removed (was already #if 0'd out).
This commit is contained in:
parent
ca53696814
commit
3608635ec6
105
job.c
105
job.c
@ -1071,111 +1071,6 @@ child_execute_job (stdin_fd, stdout_fd, argv, envp)
|
||||
exec_command (argv, envp);
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
/* Default path to search for executables. */
|
||||
static char default_path[] = ":/bin:/usr/bin";
|
||||
|
||||
/* Search PATH for FILE.
|
||||
If successful, store the full pathname in PROGRAM and return 1.
|
||||
If not sucessful, return zero. */
|
||||
|
||||
static int
|
||||
search_path (file, path, program)
|
||||
char *file, *path, *program;
|
||||
{
|
||||
if (path == 0 || path[0] == '\0')
|
||||
path = default_path;
|
||||
|
||||
if (
|
||||
#ifdef __MSDOS__
|
||||
strpbrk (file, "/\\:")
|
||||
#else
|
||||
index (file, '/')
|
||||
#endif
|
||||
!= 0)
|
||||
{
|
||||
strcpy (program, file);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned int len;
|
||||
|
||||
#ifdef HAVE_GETGROUPS
|
||||
#ifndef HAVE_UNISTD_H
|
||||
extern int getgroups ();
|
||||
#endif
|
||||
static int ngroups = -1;
|
||||
#ifdef NGROUPS_MAX
|
||||
static GETGROUPS_T groups[NGROUPS_MAX];
|
||||
#define ngroups_max NGROUPS_MAX
|
||||
#else
|
||||
static GETGROUPS_T *groups = 0;
|
||||
static int ngroups_max;
|
||||
if (groups == 0)
|
||||
{
|
||||
ngroups_max = GET_NGROUPS_MAX;
|
||||
groups = (GETGROUPS_T *) malloc (ngroups_max * sizeof (GETGROUPS_T));
|
||||
}
|
||||
#endif
|
||||
if (groups != 0 && ngroups == -1)
|
||||
ngroups = getgroups (ngroups_max, groups);
|
||||
#endif /* Have getgroups. */
|
||||
|
||||
len = strlen (file) + 1;
|
||||
do
|
||||
{
|
||||
struct stat st;
|
||||
int perm;
|
||||
char *p;
|
||||
|
||||
p = index (path, PATH_SEPARATOR_CHAR);
|
||||
if (p == 0)
|
||||
p = path + strlen (path);
|
||||
|
||||
if (p == path)
|
||||
bcopy (file, program, len);
|
||||
else
|
||||
{
|
||||
bcopy (path, program, p - path);
|
||||
program[p - path] = '/';
|
||||
bcopy (file, program + (p - path) + 1, len);
|
||||
}
|
||||
|
||||
if (safe_stat (program, &st) == 0
|
||||
&& S_ISREG (st.st_mode))
|
||||
{
|
||||
if (st.st_uid == geteuid ())
|
||||
perm = (st.st_mode & 0100);
|
||||
else if (st.st_gid == getegid ())
|
||||
perm = (st.st_mode & 0010);
|
||||
else
|
||||
{
|
||||
#ifdef HAVE_GETGROUPS
|
||||
register int i;
|
||||
for (i = 0; i < ngroups; ++i)
|
||||
if (groups[i] == st.st_gid)
|
||||
break;
|
||||
if (i < ngroups)
|
||||
perm = (st.st_mode & 0010);
|
||||
else
|
||||
#endif /* Have getgroups. */
|
||||
perm = (st.st_mode & 0001);
|
||||
}
|
||||
|
||||
if (perm != 0)
|
||||
return 1;
|
||||
}
|
||||
|
||||
path = p + 1;
|
||||
} while (*path != '\0');
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* search_path commented out */
|
||||
|
||||
/* Replace the current process with one running the command in ARGV,
|
||||
with environment ENVP. This function does not return. */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user