If find_pid_by_name() had an error, it was returning -1, but storing
that into a pid_t, which is unsigned on a number archs. Furthermore, find_pid_by_name() would _never_ return an error if the intended proces was "init", but instead would return 1, meaning we would fail to work on 2.4.x kernels running an initrd... -Erik
This commit is contained in:
@@ -58,7 +58,7 @@ extern int pidof_main(int argc, char **argv)
|
||||
|
||||
/* Looks like everything is set to go. */
|
||||
while(optind < argc) {
|
||||
pid_t* pidList;
|
||||
long* pidList;
|
||||
|
||||
pidList = find_pid_by_name( argv[optind]);
|
||||
if (!pidList || *pidList<=0) {
|
||||
|
||||
Reference in New Issue
Block a user