]> granicus.if.org Git - psmisc/commitdiff
NULLptr sanity added in scan fns to avoid useless prep work (stalls NFS)
authorJan Rybar <jrybar@redhat.com>
Tue, 19 Feb 2019 15:39:17 +0000 (16:39 +0100)
committerJan Rybar <jrybar@redhat.com>
Tue, 19 Feb 2019 15:39:17 +0000 (16:39 +0100)
src/fuser.c

index c44cee87a4a1eb31228e58e0fc57c845f7a23917..b8662a3ce62d954c64c6361c6bfa17e86c6bf91e 100644 (file)
@@ -188,6 +188,9 @@ scan_procs(struct names *names_head, struct inode_list *ino_head,
        pid_t pid, my_pid;
        uid_t uid;
 
+       if ( (ino_head == NULL) && (dev_head == NULL) )
+               return;
+
        if ((topproc_dir = opendir("/proc")) == NULL) {
                fprintf(stderr, _("Cannot open /proc directory: %s\n"),
                        strerror(errno));
@@ -1873,6 +1876,10 @@ scan_knfsd(struct names *names_head, struct inode_list *ino_head,
        char *find_space;
        struct stat st;
 
+       if ( (ino_head == NULL) && (dev_head == NULL) )
+               return;
+
+
        if ((fp = fopen(KNFSD_EXPORTS, "r")) == NULL) {
 #ifdef DEBUG
                printf("Cannot open %s\n", KNFSD_EXPORTS);
@@ -1919,6 +1926,10 @@ scan_mounts(struct names *names_head, struct inode_list *ino_head,
        char *find_space;
        struct stat st;
 
+       if ( (ino_head == NULL) && (dev_head == NULL) )
+               return;
+
+
        if ((fp = fopen(PROC_MOUNTS, "r")) == NULL) {
                fprintf(stderr, "Cannot open %s\n", PROC_MOUNTS);
                return;
@@ -1962,6 +1973,9 @@ scan_swaps(struct names *names_head, struct inode_list *ino_head,
        char *find_space;
        struct stat st;
 
+       if ( (ino_head == NULL) && (dev_head == NULL) )
+               return;
+
        if ((fp = fopen(PROC_SWAPS, "r")) == NULL) {
                /*fprintf(stderr, "Cannot open %s\n", PROC_SWAPS); */
                return;