Package: procps
Version: 3.3.8-2
Severity: normal
Tags: patch
User: [email protected]
Usertags: origin-ubuntu ubuntu-patch saucy
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. Patch
attached.
Thanks,
--
Colin Watson [[email protected]]
Index: b/pwdx.c
===================================================================
--- a/pwdx.c
+++ b/pwdx.c
@@ -52,6 +52,7 @@
if (!strncmp("/proc/", input, 6))
skip = 6;
+ errno = 0;
pid = strtol(input + skip, &end, 10);
if (errno || input + skip == end || (end && *end))