Whamcloud - gitweb
tst_libext2fs: Avoid multiple definition of global variables
[tools/e2fsprogs.git] / debugfs / debugfs.c
index 1e99fa6..e33c92e 100644 (file)
@@ -48,8 +48,14 @@ extern char *optarg;
 int journal_enable_debug = -1;
 #endif
 
+/*
+ * There must be only one definition if we're hooking in extra commands or
+ * chaging default prompt. Use -DSKIP_GLOBDEF for that.
+ */
+#ifndef SKIP_GLOBDEFS
 ss_request_table *extra_cmds;
 const char *debug_prog_name;
+#endif
 int ss_sci_idx;
 
 ext2_filsys    current_fs;
@@ -848,7 +854,7 @@ void internal_dump_inode(FILE *out, const char *prefix,
        if (is_large_inode && large_inode->i_extra_isize >= 32)
                fprintf(out, "   Project: %5d", large_inode->i_projid);
        fputs("   Size: ", out);
-       if (LINUX_S_ISREG(inode->i_mode))
+       if (LINUX_S_ISREG(inode->i_mode) || LINUX_S_ISDIR(inode->i_mode))
                fprintf(out, "%llu\n", EXT2_I_SIZE(inode));
        else
                fprintf(out, "%d\n", inode->i_size);
@@ -2446,8 +2452,10 @@ void do_dump_mmp(int argc EXT2FS_ATTR((unused)), char *argv[],
        fprintf(stdout, "check_interval: %d\n", mmp_s->mmp_check_interval);
        fprintf(stdout, "sequence: %08x\n", mmp_s->mmp_seq);
        fprintf(stdout, "time: %lld -- %s", mmp_s->mmp_time, ctime(&t));
-       fprintf(stdout, "node_name: %s\n", mmp_s->mmp_nodename);
-       fprintf(stdout, "device_name: %s\n", mmp_s->mmp_bdevname);
+       fprintf(stdout, "node_name: %.*s\n",
+               EXT2_LEN_STR(mmp_s->mmp_nodename));
+       fprintf(stdout, "device_name: %.*s\n",
+               EXT2_LEN_STR(mmp_s->mmp_bdevname));
        fprintf(stdout, "magic: 0x%x\n", mmp_s->mmp_magic);
        fprintf(stdout, "checksum: 0x%08x\n", mmp_s->mmp_checksum);
 }