diff options
author | Ned Ludd <solar@gentoo.org> | 2005-03-25 14:49:27 +0000 |
---|---|---|
committer | Ned Ludd <solar@gentoo.org> | 2005-03-25 14:49:27 +0000 |
commit | 3185fbd468e8f61173cdf190eda9acba294f60a6 (patch) | |
tree | 7cdde340071179daaae59d8494f8f2f43d959226 /pspax.c | |
parent | man page updates (diff) | |
download | pax-utils-3185fbd468e8f61173cdf190eda9acba294f60a6.tar.gz pax-utils-3185fbd468e8f61173cdf190eda9acba294f60a6.tar.bz2 pax-utils-3185fbd468e8f61173cdf190eda9acba294f60a6.zip |
- small source code correction
Diffstat (limited to 'pspax.c')
-rw-r--r-- | pspax.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -30,7 +30,6 @@ #include <sys/types.h> #include <sys/mman.h> #include <fcntl.h> -// #include <dlfcn.h> #ifdef __linux__ #include <elf.h> @@ -104,8 +103,8 @@ extern char *basename(); char *get_proc_name(pid_t pid) { FILE *fp; - static char buf[PATH_MAX]; - + char buf[PATH_MAX]; + static char *p = "-----"; memset(&buf, 0, sizeof(buf)); snprintf(buf, sizeof(buf), "/proc/%d/stat", (int) pid); @@ -113,17 +112,18 @@ char *get_proc_name(pid_t pid) fp = fopen(buf, "r"); if (fp == NULL) - return "-----"; + return p; fscanf(fp, "%*d %s.16", buf); if (*buf) { buf[strlen(buf) - 1] = '\0'; buf[16] = 0; - strcpy(buf, &buf[1]); + p = buf; + *p++; } fclose(fp); - return buf; + return p; } struct passwd *get_proc_uid(pid_t pid) |