From: Theodore Ts'o Date: Fri, 3 Jun 2016 03:05:11 +0000 (-0400) Subject: debugfs: fix rdump so it can start from the root directory X-Git-Tag: v1.43.1~21 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=ebb8b1aa045a0a43344c4ae581e1c342a9724d23;p=tools%2Fe2fsprogs.git debugfs: fix rdump so it can start from the root directory Previously "rdump / /tmp/out" would fail with the error message: rdump: File exists while making directory /tmp/out/ Also fix the fast symlink detection logic so that it works when a symlink has one or more extended attributes. Addresses-Debian-Bug: #766125 Signed-off-by: Theodore Ts'o --- diff --git a/debugfs/dump.c b/debugfs/dump.c index 1dc6154..4d38651 100644 --- a/debugfs/dump.c +++ b/debugfs/dump.c @@ -210,7 +210,7 @@ static void rdump_symlink(ext2_ino_t ino, struct ext2_inode *inode, /* Apparently, this is the right way to detect and handle fast * symlinks; see do_stat() in debugfs.c. */ - if (inode->i_blocks == 0) + if (ext2fs_inode_data_blocks2(current_fs, inode) == 0) strcpy(buf, (char *) inode->i_block); else { unsigned bytes = inode->i_size; @@ -284,7 +284,7 @@ static void rdump_inode(ext2_ino_t ino, struct ext2_inode *inode, /* Create the directory with 0700 permissions, because we * expect to have to create entries it. Then fix its perms * once we've done the traversal. */ - if (mkdir(fullname, S_IRWXU) == -1) { + if (name[0] && mkdir(fullname, S_IRWXU) == -1) { com_err("rdump", errno, "while making directory %s", fullname); goto errout; }