This commit is contained in:
Roy Marples 2008-04-30 10:31:06 +00:00
parent cedd81801a
commit 35b4978152

View File

@ -91,8 +91,8 @@ static bool pid_is_exec(pid_t pid, const char *const *argv)
int r; int r;
/* Check it's the right binary */ /* Check it's the right binary */
snprintf (cmdline, sizeof (cmdline), "/proc/%u/exe", pid); snprintf(cmdline, sizeof(cmdline), "/proc/%u/exe", pid);
memset (buffer, 0, sizeof (buffer)); memset(buffer, 0, sizeof(buffer));
if (readlink(cmdline, buffer, sizeof(buffer)) != -1) { if (readlink(cmdline, buffer, sizeof(buffer)) != -1) {
if (strcmp(*argv, buffer) == 0) if (strcmp(*argv, buffer) == 0)
return true; return true;
@ -125,7 +125,7 @@ static bool pid_is_exec(pid_t pid, const char *const *argv)
return false; return false;
argv++; argv++;
p += strlen(p) + 1; p += strlen(p) + 1;
if ((unsigned) (p - buffer) > sizeof (buffer)) if ((unsigned)(p - buffer) > sizeof(buffer))
return false; return false;
} }
return true; return true;