]> granicus.if.org Git - psmisc/commitdiff
fuser -n tcp ,,x works for ipv6 and 4
authorCraig Small <csmall@users.sourceforge.net>
Wed, 11 Apr 2007 23:20:00 +0000 (23:20 +0000)
committerCraig Small <csmall@users.sourceforge.net>
Wed, 11 Apr 2007 23:20:00 +0000 (23:20 +0000)
ChangeLog
src/fuser.c

index c168629901a8261dc04beea142cbd848fb6dfb96..38c2a961edc93654a8883125c9e4163619064593 100644 (file)
--- 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 <path> does textual path comparision with value of the
          /proc/<pid>/exe link when a comparision with inode number failed.
index 72292b366422fadf9f70bfbfa54fe6c5432b5a5e..77745568dcb76dd3e41c35ea43aafdd56faeaa9d 100644 (file)
@@ -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);