-
Committer:
Carlos R. Mafra
-
Author(s):
Diedrich Vorberg
-
Date:
2020-10-19 19:38:29 UTC
-
Revision ID:
git-v1:a98680cd149606210f776eb68d02cecfc69e61e2
Patch for GetCommandForPid() in osdep_darwin.c
the function mentioned above caused segfaults on MacOS. The attached patch
seems to solve that.
Details: The functions provides an array of string pointers (the argument
vector) pointing to a buffer allocated and referred to by a static local
variable `args`. This buffer was used on each subsequent call. For one
thing this would overwrite old values and for another this caused segfaults.
My new implementation allocates a buffer for the argument vector plus the
actual string data on each call. The caller will wfree() the buffer, but
until then has available an independent copy of the strings.