summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/test.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/test.c b/src/test.c
index d52c3aef1..3b01f13d4 100644
--- a/src/test.c
+++ b/src/test.c
@@ -155,6 +155,7 @@ eaccess (char const *file, int mode)
egid = getegid ();
}
+ /* Set the real user and group IDs to the effective ones. */
if (uid != euid)
setreuid (euid, uid);
if (gid != egid)
@@ -162,10 +163,11 @@ eaccess (char const *file, int mode)
result = access (file, mode);
+ /* Restore them. */
if (uid != euid)
- setreuid (euid, uid);
+ setreuid (uid, euid);
if (gid != egid)
- setregid (egid, gid);
+ setregid (gid, egid);
return result;
}