library: revert changes to 'look_up_our_self' function

The patch below is where most proc_t fixed size arrays
became simple pointers to char. In that commit changes
to the above function were made so that dynamic memory
was freed which included the program name (cmd) field.

That change was prompted by a valgrind reported memory
leak during development that no longer seems to exist.
However, by keeping the look_up_our_self() changes the
ps command without args then fails to report anything.

So this patch just restores the expected old behavior.

Reference(s):
commit 3881a0844a

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2015-08-23 00:00:00 -05:00 committed by Craig Small
parent 64238730fa
commit e949b78c30

View File

@ -1426,9 +1426,7 @@ void look_up_our_self(proc_t *p) {
fprintf(stderr, "Error, do this: mount -t proc proc /proc\n"); fprintf(stderr, "Error, do this: mount -t proc proc /proc\n");
_exit(47); _exit(47);
} }
memset(p, 0, sizeof(*p));
stat2proc(ub.buf, p); // parse /proc/self/stat stat2proc(ub.buf, p); // parse /proc/self/stat
free_acquired(p, 0);
free(ub.buf); free(ub.buf);
} }