mirror of
https://git.savannah.gnu.org/git/make.git
synced 2025-02-07 06:47:52 +00:00
Formerly misc.c.~25~
This commit is contained in:
parent
04789f11cd
commit
a03f503fb7
1 changed files with 27 additions and 0 deletions
27
misc.c
27
misc.c
|
@ -499,6 +499,22 @@ static int user_uid = -1, user_gid = -1, make_uid = -1, make_gid = -1;
|
||||||
#define access_inited (user_uid != -1)
|
#define access_inited (user_uid != -1)
|
||||||
static enum { make, user } current_access;
|
static enum { make, user } current_access;
|
||||||
|
|
||||||
|
|
||||||
|
/* Under -d, write a message describing the current IDs. */
|
||||||
|
|
||||||
|
static void
|
||||||
|
log_access (flavor)
|
||||||
|
char *flavor;
|
||||||
|
{
|
||||||
|
if (! debug_flag)
|
||||||
|
return;
|
||||||
|
|
||||||
|
printf ("%s access: user %d (real %d), group %d (real %d)\n",
|
||||||
|
flavor, geteuid (), getuid (), getegid (), getgid ());
|
||||||
|
fflush (stdout);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
init_access ()
|
init_access ()
|
||||||
{
|
{
|
||||||
|
@ -512,6 +528,8 @@ init_access ()
|
||||||
if (user_uid == -1 || user_gid == -1 || make_uid == -1 || make_gid == -1)
|
if (user_uid == -1 || user_gid == -1 || make_uid == -1 || make_gid == -1)
|
||||||
pfatal_with_name ("get{e}[gu]id");
|
pfatal_with_name ("get{e}[gu]id");
|
||||||
|
|
||||||
|
log_access ("Initialized");
|
||||||
|
|
||||||
current_access = make;
|
current_access = make;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -572,6 +590,8 @@ user_access ()
|
||||||
|
|
||||||
current_access = user;
|
current_access = user;
|
||||||
|
|
||||||
|
log_access ("User");
|
||||||
|
|
||||||
#endif /* GETLOADAVG_PRIVILEGED */
|
#endif /* GETLOADAVG_PRIVILEGED */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -608,6 +628,8 @@ make_access ()
|
||||||
|
|
||||||
current_access = make;
|
current_access = make;
|
||||||
|
|
||||||
|
log_access ("Make");
|
||||||
|
|
||||||
#endif /* GETLOADAVG_PRIVILEGED */
|
#endif /* GETLOADAVG_PRIVILEGED */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -616,6 +638,9 @@ make_access ()
|
||||||
void
|
void
|
||||||
child_access ()
|
child_access ()
|
||||||
{
|
{
|
||||||
|
if (!access_inited)
|
||||||
|
abort ();
|
||||||
|
|
||||||
#ifdef GETLOADAVG_PRIVILEGED
|
#ifdef GETLOADAVG_PRIVILEGED
|
||||||
|
|
||||||
/* Set both the real and effective UID and GID to the user's.
|
/* Set both the real and effective UID and GID to the user's.
|
||||||
|
@ -637,6 +662,8 @@ child_access ()
|
||||||
pfatal_with_name ("child_access: setregid");
|
pfatal_with_name ("child_access: setregid");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
log_access ("Child");
|
||||||
|
|
||||||
#endif /* GETLOADAVG_PRIVILEGED */
|
#endif /* GETLOADAVG_PRIVILEGED */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue