diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/legacy/cuserid.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/legacy/cuserid.c b/src/legacy/cuserid.c index 4e78798d..fd7832e4 100644 --- a/src/legacy/cuserid.c +++ b/src/legacy/cuserid.c @@ -5,10 +5,12 @@ char *cuserid(char *buf) { + static char usridbuf[L_cuserid]; struct passwd pw, *ppw; long pwb[256]; if (getpwuid_r(geteuid(), &pw, (void *)pwb, sizeof pwb, &ppw)) return 0; + if (!buf) buf = usridbuf; snprintf(buf, L_cuserid, "%s", pw.pw_name); return buf; } |