]> granicus.if.org Git - psmisc/commitdiff
fuser: -k return status based on any found
authorCraig Small <csmall@enc.com.au>
Sat, 14 Mar 2015 22:08:12 +0000 (09:08 +1100)
committerCraig Small <csmall@enc.com.au>
Sat, 14 Mar 2015 22:08:12 +0000 (09:08 +1100)
In [bugs:#66] the ever-helpful "Anonymous" reported that
fuser with -k would only return correctly if the process
was found last and not if it was found anywhere.

While I have solved this problem a different way, the report
was enough to narrow down what was going wrong. Now fuser -k
returns 1 if it finds any process to kill, not just if the last
one was; just like fuser with no -k works.

Signed-off-by: Craig Small <csmall@enc.com.au>
src/fuser.c

index 4e16d676a3ab79870d22135840ada0084f73e299..4eeac7decfd28c866f2e6b03dc40cdf02a2f0729 100644 (file)
@@ -1397,7 +1397,7 @@ print_matches(struct names *names_head, const opt_type opts,
                        }
                }               /* be silent */
                if (opts & OPT_KILL)
-                       have_kill = kill_matched_proc(nptr->matched_procs,
+                       have_kill |= kill_matched_proc(nptr->matched_procs,
                                                      opts, sig_number);
 
        }                       /* next name */