]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_fsr: check strdup results properly in initallfs()
authorEric Sandeen <sandeen@redhat.com>
Sat, 26 Jan 2013 22:40:30 +0000 (22:40 +0000)
committerMark Tinguely <tinguely@eagdhcp-232-136.americas.sgi.com>
Thu, 21 Feb 2013 16:09:11 +0000 (10:09 -0600)
initallfs() does 2 strdups, but then checks the result
of one of them twice, rather then checking each one.
Fix this.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Mark Tinguely <tinguely@sgi.com>
Signed-off-by: Mark Tinguely <tinguely@sgi.com>
fsr/xfs_fsr.c

index 843f57d707669334bfa756be765abd8dcfa415e5..b5aa3db76f751b018080fc5512ca258e8f7fad21 100644 (file)
@@ -470,10 +470,14 @@ initallfs(char *mtab)
                fs->dev = strdup(mp->mnt_fsname);
                fs->mnt = strdup(mp->mnt_dir);
 
-               if (fs->mnt == NULL || fs->mnt == NULL) {
+               if (fs->dev == NULL) {
                        fsrprintf(_("strdup(%s) failed\n"), mp->mnt_fsname);
                        exit(1);
                }
+               if (fs->mnt == NULL) {
+                       fsrprintf(_("strdup(%s) failed\n"), mp->mnt_dir);
+                       exit(1);
+               }
                mi++;
                fs++;
        }