r11560: Fix core dump if setmntent returns NULL.
authorJeremy Allison <jra@samba.org>
Mon, 7 Nov 2005 19:18:00 +0000 (19:18 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:05:20 +0000 (11:05 -0500)
Pointed out by Jay Fanlason @ Red Hat.
Jeremy.
(This used to be commit e8136ae746b5be51b252d900aa732c8106fefcaf)

source3/lib/sysquotas.c

index 52a598a4e6b1d73ff6c090d2733c053a70eb31ea..c1ab6ef8cfab2cd9606edb3149fe85234321a9ec 100644 (file)
@@ -67,6 +67,9 @@ static int sys_path_to_bdev(const char *path, char **mntpath, char **bdev, char
        devno = S.st_dev ;
 
        fp = setmntent(MOUNTED,"r");
+       if (fp == NULL) {
+               return -1;
+       }
   
        while ((mnt = getmntent(fp))) {
                if ( sys_stat(mnt->mnt_dir,&S) == -1 )