diff options
author | Erik Andersen | 2000-04-18 22:41:30 +0000 |
---|---|---|
committer | Erik Andersen | 2000-04-18 22:41:30 +0000 |
commit | b9167cb67f3316e2220cc4d209bb75880d619bc6 (patch) | |
tree | 2db48e0c162a1fab3bd00fd2c314d6e9e2d8c007 /utility.c | |
parent | 632bb571357c4cef455c00fb06493810284e544d (diff) | |
download | busybox-b9167cb67f3316e2220cc4d209bb75880d619bc6.zip busybox-b9167cb67f3316e2220cc4d209bb75880d619bc6.tar.gz |
Really fix the killall segfault this time.
-Erik
Diffstat (limited to 'utility.c')
-rw-r--r-- | utility.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -1315,7 +1315,8 @@ extern pid_t* findPidByName( char* pidName) if (isspace(*(p))) *p='\0'; - if ((strstr(info.command_line, pidName) != NULL)) { + if ((strstr(info.command_line, pidName) != NULL) + && (strlen(pidName) == strlen(info.command_line))) { pidList=realloc( pidList, sizeof(pid_t) * (j+2)); if (pidList==NULL) fatalError("out of memory\n"); @@ -1362,7 +1363,7 @@ extern pid_t* findPidByName( char* pidName) FILE *status; char filename[256]; char buffer[256]; - char* p, *q; + char* p; /* If it isn't a number, we don't want it */ if (!isdigit(*next->d_name)) @@ -1387,8 +1388,8 @@ extern pid_t* findPidByName( char* pidName) } p=buffer+6; /* Skip the "Name:\t" */ - if (((q=strstr(p, pidName)) != NULL) - && (strncmp(q, pidName, strlen(pidName)) != 0)) { + if ((strstr(p, pidName) != NULL) + && (strlen(pidName) == strlen(p))) { pidList=realloc( pidList, sizeof(pid_t) * (i+2)); if (pidList==NULL) fatalError("out of memory\n"); |