diff options
author | Peter Fales <psfales@alcatel-lucent.com> | 2008-03-25 22:44:01 +0100 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2008-03-25 22:47:15 +0100 |
commit | f7d1c59c224f81a8bab5fa2afcaf815988f50467 (patch) | |
tree | 90dd8d9751be9c967320c0537dfd402d3572faa6 | |
parent | 5f2ea441ac7eb7ace61e1ae422c5ae9165f02258 (diff) | |
download | coreutils-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.
-rw-r--r-- | src/id.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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 (); |