diff options
author | Roy Marples <roy@marples.name> | 2008-04-30 16:26:05 +0000 |
---|---|---|
committer | Roy Marples <roy@marples.name> | 2008-04-30 16:26:05 +0000 |
commit | 5b800030f11b78a73e65e06e858d22756f98d60f (patch) | |
tree | 7a5323b63e6710c9d717ff11e1124fcf6da13a0b | |
parent | 208443fa0ecb600ce5c4122b32d9af2f2667a226 (diff) |
Remove redundant checking of /proc/pid/exe
-rw-r--r-- | src/librc/librc-daemon.c | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/src/librc/librc-daemon.c b/src/librc/librc-daemon.c index e2e3bbf1..98744e1e 100644 --- a/src/librc/librc-daemon.c +++ b/src/librc/librc-daemon.c @@ -83,34 +83,12 @@ static bool pid_is_exec(pid_t pid, const char *const *argv) { char cmdline[32]; char buffer[PATH_MAX]; - char *p; int fd; ssize_t bytes; - /* Check it's the right binary */ - snprintf(cmdline, sizeof(cmdline), "/proc/%u/exe", pid); - bytes = readlink(cmdline, buffer, sizeof(buffer)); - if (bytes > 0) { - buffer[bytes] = '\0'; - if (strcmp(*argv, buffer) == 0) - return true; - - /* We should cater for deleted binaries too */ - bytes = strlen(buffer); - if (bytes) { - p = buffer + (bytes - 10); - if (strcmp(p, " (deleted)") == 0) { - *p = '\0'; - if (strcmp(buffer, *argv) == 0) - return true; - } - } - } - snprintf(cmdline, sizeof(cmdline), "/proc/%u/cmdline", pid); if ((fd = open(cmdline, O_RDONLY)) < 0) return false; - bytes = read(fd, buffer, sizeof(buffer)); close(fd); if (bytes == -1) |