psmisc/psmisc-22.6-netunix.patch

37 lines
1.1 KiB
Diff
Raw Normal View History

--- src/fuser.c
+++ src/fuser.c 2008-05-16 14:58:07.906452331 +0200
@@ -1310,12 +1310,21 @@ void fill_unix_cache(struct unixsocket_l
return;
}
while (fgets(line, BUFSIZ, fp) != NULL) {
+ char * path;
+ scanned_path = (char*)0;
if (sscanf(line, "%*x: %*x %*x %*x %*x %*d %d %as",
- &scanned_inode,
- &scanned_path) != 2)
+ &scanned_inode, &scanned_path) != 2) {
+ if (scanned_path)
+ free(scanned_path);
continue;
+ }
+ if (scanned_path == (char*)0)
+ continue;
+ path = scanned_path;
+ if (*scanned_path == '@')
+ scanned_path++;
if (stat(scanned_path, &st) < 0) {
- free(scanned_path);
+ free(path);
continue;
}
if ( (newsocket = malloc(sizeof(struct unixsocket_list))) == NULL)
@@ -1323,7 +1332,7 @@ void fill_unix_cache(struct unixsocket_l
newsocket->sun_name = strdup(scanned_path);
newsocket->inode = st.st_ino;
newsocket->dev = st.st_dev;
- newsocket->net_inode = scanned_inode;
+ newsocket->net_inode = scanned_inode;
newsocket->next = *unixsocket_head;
*unixsocket_head = newsocket;
} /* while */