From: Craig Small Date: Wed, 11 Apr 2007 23:20:00 +0000 (+0000) Subject: fuser -n tcp ,,x works for ipv6 and 4 X-Git-Tag: v22.11~66 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=43980ab0b8031d663258c6601e40b1caf05d2593;p=psmisc fuser -n tcp ,,x works for ipv6 and 4 --- diff --git a/ChangeLog b/ChangeLog index c168629..38c2a96 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ Changes in 22.4 =============== +2007-04-11 Craig Small + * fuser correctly parses remote tcp ports Debian #397033 + * Removed extra blank lines in fuser Debian #386564 + 2007-03-02 Karel Zak * killall does textual path comparision with value of the /proc//exe link when a comparision with inode number failed. diff --git a/src/fuser.c b/src/fuser.c index 72292b3..7774556 100644 --- a/src/fuser.c +++ b/src/fuser.c @@ -640,7 +640,8 @@ void find_net6_sockets(struct inode_list **ino_list, struct ip6_connections *con #endif /* DEBUG */ if ( (conn_tmp->lcl_port == 0 || conn_tmp->lcl_port == loc_port) && (conn_tmp->rmt_port == 0 || conn_tmp->rmt_port == rmt_port) && - (memcmp(&(conn_tmp->rmt_address), &(rmt_addr),16) ==0) + (memcmp(&(conn_tmp->rmt_address), &in6addr_any,16) == 0 || + (memcmp(&(conn_tmp->rmt_address), &(rmt_addr),16) ==0)) ) { add_inode(ino_list, conn_tmp->name, netdev, inode); } @@ -888,7 +889,7 @@ static int print_matches(struct names *names_head, const opt_type opts, const in } else { /* We're not silent */ if (nptr->matched_procs != NULL || opts & OPT_ALLFILES) { if (head == 0 && opts & OPT_VERBOSE) { - fprintf(stderr, _("\n%*s USER PID ACCESS COMMAND\n"), + fprintf(stderr, _("%*s USER PID ACCESS COMMAND\n"), NAME_FIELD, ""); head = 1; } @@ -951,8 +952,14 @@ static int print_matches(struct names *names_head, const opt_type opts, const in len = 0; first = 0; } - if (nptr->matched_procs != NULL || opts & OPT_ALLFILES) + if (opts & OPT_VERBOSE) { + /* put a newline if showing all files and no procs*/ + if (nptr->matched_procs == NULL && (opts & OPT_ALLFILES)) + putc('\n', stderr); + } else { + if (nptr->matched_procs != NULL || (opts & OPT_ALLFILES)) putc('\n', stderr); + } } /* be silent */ if (opts & OPT_KILL) kill_matched_proc(nptr->matched_procs, opts, sig_number);