Commit b5ec91a5 authored by Eli Zaretskii's avatar Eli Zaretskii

(procfs_system_process_attributes): If `nread' has a negative value, assign

zero to it.
parent b3f1f4a5
2008-12-05 Eli Zaretskii <eliz@gnu.org>
* process.c (procfs_system_process_attributes): If `nread' has a
negative value, assign zero to it.
2008-12-05 Chong Yidong <cyd@stupidchicken.com>
* eval.c (Vdebug_on_error): Doc fix.
......
......@@ -7434,6 +7434,14 @@ procfs_system_process_attributes (pid)
cmdline[0] = '\0';
if ((nread = read (fd, cmdline, cmdline_size)) >= 0)
cmdline[nread++] = '\0';
else
{
/* Assigning zero to `nread' makes us skip the following
two loops, assign zero to cmdline_size, and enter the
following `if' clause that handles unknown command
lines. */
nread = 0;
}
/* We don't want trailing null characters. */
for (p = cmdline + nread - 1; p > cmdline && !*p; p--)
nread--;
......@@ -7451,7 +7459,7 @@ procfs_system_process_attributes (pid)
}
cmdline_size = nread;
}
else
if (!cmdline_size)
{
if (!cmd)
cmd = "???";
......
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