1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-08-12 12:00:21 +02:00

id bug fix: don't point to potentially clobbered static storage

On at least Mac OS, when calling getpwuid twice with the same UID,
the static storage containing results from the first call is
invalidated by the second call.
* src/id.c (main): Point to a copy of the user name string.
This commit is contained in:
Peter Fales
2008-03-25 22:44:01 +01:00
committed by Jim Meyering
parent 5f2ea441ac
commit f7d1c59c22
+1 -1
View File
@@ -211,7 +211,7 @@ of a different user"));
struct passwd const *pwd;
euid = geteuid ();
pwd = getpwuid (euid);
user_name = pwd ? pwd->pw_name : NULL;
user_name = pwd ? xstrdup (pwd->pw_name) : NULL;
ruid = getuid ();
egid = getegid ();
rgid = getgid ();