From: Craig Small Date: Fri, 13 Nov 2009 02:28:57 +0000 (+0000) Subject: fuser only kills normal processes, patch thanks to Erik Li SF# 2892724 X-Git-Tag: v22.11~15 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=364a576217e1fb9160f22c6beac4923e1b470842;p=psmisc fuser only kills normal processes, patch thanks to Erik Li SF# 2892724 --- diff --git a/ChangeLog b/ChangeLog index b14b46d..e3818b3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ Changes in 22.9 =============== * short option l returned in fuser Debian #539087 + * long options terminated with 0s Debian #551833 + * fuser only kills normal processes, patch thanks to Erik Li SF# 2892724 Changes in 22.8 =============== diff --git a/src/fuser.c b/src/fuser.c index 0109ff1..291b657 100644 --- a/src/fuser.c +++ b/src/fuser.c @@ -808,8 +808,7 @@ int main(int argc, char *argv[]) {"ipv6", 0, NULL, '6'}, #endif {"SIG", 1, NULL, 'S'}, - - + { 0, 0, 0, 0 } }; #ifdef WITH_IPV6 @@ -1452,11 +1451,13 @@ kill_matched_proc(struct procs *proc_head, const opt_type opts, struct procs *pptr; for (pptr = proc_head; pptr != NULL; pptr = pptr->next) { - if ((opts & OPT_INTERACTIVE) && (ask(pptr->pid) == 0)) - continue; - if (kill(pptr->pid, sig_number) < 0) { - fprintf(stderr, _("Could not kill process %d: %s\n"), - pptr->pid, strerror(errno)); + if ( pptr->proc_type == PTYPE_NORMAL ){ + if ((opts & OPT_INTERACTIVE) && (ask(pptr->pid) == 0)) + continue; + if ( kill(pptr->pid, sig_number) < 0) { + fprintf(stderr, _("Could not kill process %d: %s\n"), + pptr->pid, strerror(errno)); + } } } diff --git a/src/killall.c b/src/killall.c index 1c87178..bc4cf15 100644 --- a/src/killall.c +++ b/src/killall.c @@ -625,9 +625,9 @@ main (int argc, char **argv) opterr = 0; #ifdef WITH_SELINUX - while ( (optc = getopt_long_only(argc,argv,"egilqrs:u:vwZ:VI",options,NULL)) != EOF) { + while ( (optc = getopt_long_only(argc,argv,"egilqrs:u:vwZ:VI",options,NULL)) != -1) { #else - while ( (optc = getopt_long_only(argc,argv,"egilqrs:u:vwVI",options,NULL)) != EOF) { + while ( (optc = getopt_long_only(argc,argv,"egilqrs:u:vwVI",options,NULL)) != -1) { #endif switch (optc) { case 'e':