summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Fales <psfales@alcatel-lucent.com>2008-03-25 22:44:01 +0100
committerJim Meyering <meyering@redhat.com>2008-03-25 22:47:15 +0100
commitf7d1c59c224f81a8bab5fa2afcaf815988f50467 (patch)
tree90dd8d9751be9c967320c0537dfd402d3572faa6 /src
parent5f2ea441ac7eb7ace61e1ae422c5ae9165f02258 (diff)
downloadcoreutils-f7d1c59c224f81a8bab5fa2afcaf815988f50467.tar.xz
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.
Diffstat (limited to 'src')
-rw-r--r--src/id.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/id.c b/src/id.c
index 9ee52e1fc..a178714fd 100644
--- a/src/id.c
+++ b/src/id.c
@@ -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 ();