diff options
author | Colin Watson <cjwatson@ubuntu.com> | 2013-08-05 20:52:22 +1000 |
---|---|---|
committer | Craig Small <csmall@enc.com.au> | 2013-08-05 20:52:22 +1000 |
commit | 26ae657950272439be23e02057debf5d83265436 (patch) | |
tree | ac1858e6cb503ade12c0ea39b22dc2c64537603e /pwdx.c | |
parent | b83788993bb2aeb2a6074ac8a2a08d4b9e49102b (diff) | |
download | procps-ng-26ae657950272439be23e02057debf5d83265436.tar.gz |
pwdx: fails when run in a nonexistent locale
pwdx rather mysteriously fails with "invalid process id" when run in a
nonexistent locale (e.g. "LC_ALL=foo pwdx $$"). This is because it
fails to obey the documented calling sequence for strtol - that is, set
errno to 0 before the call - and thus the errno from the setlocale
failure bleeds over into its check for whether strtol failed.
References: http://bugs.debian.org/718766
Signed-off-by: Craig Small <csmall@enc.com.au>
Diffstat (limited to 'pwdx.c')
-rw-r--r-- | pwdx.c | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -52,6 +52,7 @@ int check_pid_argument(char *input) if (!strncmp("/proc/", input, 6)) skip = 6; + errno = 0; pid = strtol(input + skip, &end, 10); if (errno || input + skip == end || (end && *end)) |