Commit 26ae6579 authored by Colin Watson's avatar Colin Watson Committed by Craig Small

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/718766Signed-off-by: Craig Small's avatarCraig Small <csmall@enc.com.au>
parent b8378899
......@@ -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))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment