]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
test_main: compact canNodump() source code a bit
authorMartin Matuska <martin@matuska.org>
Sun, 26 Feb 2017 22:43:56 +0000 (23:43 +0100)
committerMartin Matuska <martin@matuska.org>
Sun, 26 Feb 2017 22:44:45 +0000 (23:44 +0100)
test_utils/test_main.c

index a50ed23fdc504ffdcc59e2a77ef4af68f3795b0b..8ae6c4448fb461c5de285629b1fa2d4d3bdaae8a 100644 (file)
@@ -2326,11 +2326,10 @@ canXz(void)
 /*
  * Can this filesystem handle nodump flags.
  */
-#if defined(HAVE_STRUCT_STAT_ST_FLAGS) && defined(UF_NODUMP)
-
 int
 canNodump(void)
 {
+#if defined(HAVE_STRUCT_STAT_ST_FLAGS) && defined(UF_NODUMP)
        const char *path = "cannodumptest";
        struct stat sb;
 
@@ -2341,16 +2340,10 @@ canNodump(void)
                return (0);
        if (sb.st_flags & UF_NODUMP)
                return (1);
-       return (0);
-}
-
 #elif (defined(FS_IOC_GETFLAGS) && defined(HAVE_WORKING_FS_IOC_GETFLAGS) \
         && defined(FS_NODUMP_FL)) || \
       (defined(EXT2_IOC_GETFLAGS) && defined(HAVE_WORKING_EXT2_IOC_GETFLAGS) \
         && defined(EXT2_NODUMP_FL))
-int
-canNodump(void)
-{
        const char *path = "cannodumptest";
        int fd, r, flags;
 
@@ -2401,19 +2394,10 @@ canNodump(void)
        if (flags & EXT2_NODUMP_FL)
 #endif
                return (1);
+#endif
        return (0);
 }
 
-#else
-
-int
-canNodump()
-{
-       return (0);
-}
-
-#endif
-
 /*
  * Sleep as needed; useful for verifying disk timestamp changes by
  * ensuring that the wall-clock time has actually changed before we