From: Craig Small Date: Sun, 19 Jun 2011 04:14:22 +0000 (+1000) Subject: fuser -k return and fuser.1 ipv6 addresses X-Git-Tag: v22.14~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=98875b19e74a4a05645f9a4eb6c332f793f80842;p=psmisc fuser -k return and fuser.1 ipv6 addresses fuser understands IPv6 addresses, removed comment in fuser.1 that it doesn't Debian #609904 fuser -k only returns 0 if you kill something. --- diff --git a/ChangeLog b/ChangeLog index c67e16f..571c5eb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,7 +14,10 @@ Changes in 22.14 Hawthorne SF#3135157 * killall creates right size buffer instead of MAX_PATH Debian #623425 * check for /proc/$$/stat not /proc/self/stat which is not available - on hurb platforms. Same Debian bug as above + on hurd platforms. Same Debian bug as above + * fuser understands IPv6 addresses, removed comment in fuser.1 that it + doesn't Debian #609904 + * fuser -k only returns 0 if you kill something. Changes in 22.13 ================ diff --git a/doc/fuser.1 b/doc/fuser.1 index 0853882..d409f77 100644 --- a/doc/fuser.1 +++ b/doc/fuser.1 @@ -1,4 +1,4 @@ -.TH FUSER 1 2009-11-23 "Linux" "User Commands" +.TH FUSER 1 2011-06-19 "Linux" "User Commands" .SH NAME fuser \- identify processes using files or sockets .SH SYNOPSIS @@ -170,9 +170,6 @@ reasons. \fBudp\fR and \fBtcp\fR name spaces, and UNIX domain sockets can't be searched with kernels older than 1.3.78. .PP -\fBudp\fR and \fBtcp\fR currently work with IPv6 and IPv4, but the -address fields can only be IPv4 addresses. -.PP Accesses by the kernel are only shown with the \fB\-v\fR option. .PP The \fB\-k\fR option only works on processes. If the user is the kernel, diff --git a/src/fuser.c b/src/fuser.c index 65bd5ae..87a13bf 100644 --- a/src/fuser.c +++ b/src/fuser.c @@ -4,7 +4,7 @@ * Based on fuser.c Copyright (C) 1993-2005 Werner Almesberger and Craig Small * * Completely re-written - * Copyright (C) 2005-2010 Craig Small + * Copyright (C) 2005-2011 Craig Small * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -983,6 +983,7 @@ int main(int argc, char *argv[]) return 0; case 'm': opts |= OPT_MOUNTS; + read_proc_mounts(&mounts); break; case 'M': opts |= OPT_ISMOUNTPOINT; @@ -1162,11 +1163,12 @@ print_matches(struct names *names_head, const opt_type opts, struct passwd *pwent = NULL; int have_match = 0; int have_kill = 0; - int name_has_procs; + int name_has_procs = 0; for (nptr = names_head; nptr != NULL; nptr = nptr->next) { if (opts & OPT_SILENT) { - have_match = nptr->matched_procs ? 1 : have_match; + if (nptr->matched_procs != NULL) + have_match = 1; } else { /* We're not silent */ if ((opts & OPT_ALLFILES) == 0) { name_has_procs = 0; @@ -1306,7 +1308,10 @@ print_matches(struct names *names_head, const opt_type opts, opts, sig_number); } /* next name */ - return (have_match == 1 ? 0 : 1); + if (opts & OPT_KILL) + return (have_kill == 1 ? 0 : 1); + else + return (have_match == 1 ? 0 : 1); }