Whamcloud - gitweb
Fix compile error and warnings for old gcc versions
[tools/e2fsprogs.git] / misc / e2undo.c
index 72e756a..71991e0 100644 (file)
@@ -21,6 +21,7 @@
 #include <errno.h>
 #endif
 #include <unistd.h>
+#include <libgen.h>
 #include "ext2fs/ext2fs.h"
 #include "support/nls-enable.h"
 
@@ -80,8 +81,14 @@ struct undo_key_block {
        __le32 magic;           /* KEYBLOCK_MAGIC number */
        __le32 crc;             /* block checksum */
        __le64 reserved;        /* zero */
-
+#if __GNUC_PREREQ (4, 8)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic"
+#endif
        struct undo_key keys[0];        /* keys, which come immediately after */
+#if __GNUC_PREREQ (4, 8)
+#pragma GCC diagnostic pop
+#endif
 };
 
 struct undo_key_info {
@@ -114,7 +121,7 @@ static char *undo_file;
 static void usage(void)
 {
        fprintf(stderr,
-               _("Usage: %s [-f] [-h] [-n] [-v] <transaction file> <filesystem>\n"), prg_name);
+               _("Usage: %s [-f] [-h] [-n] [-o offset] [-v] [-z undo_file] <transaction file> <filesystem>\n"), prg_name);
        exit(1);
 }
 
@@ -207,8 +214,7 @@ static int key_compare(const void *a, const void *b)
 
        ka = a;
        kb = b;
-       return ext2fs_le64_to_cpu(ka->fsblk) -
-              ext2fs_le64_to_cpu(kb->fsblk);
+       return ka->fsblk - kb->fsblk;
 }
 
 static int e2undo_setup_tdb(const char *name, io_manager *io_ptr)