mirror of https://github.com/vitalif/e2fsprogs
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 <tytso@mit.edu>debian
parent
377e3a9657
commit
ebb8b1aa04
|
@ -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
|
/* Apparently, this is the right way to detect and handle fast
|
||||||
* symlinks; see do_stat() in debugfs.c. */
|
* 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);
|
strcpy(buf, (char *) inode->i_block);
|
||||||
else {
|
else {
|
||||||
unsigned bytes = inode->i_size;
|
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
|
/* Create the directory with 0700 permissions, because we
|
||||||
* expect to have to create entries it. Then fix its perms
|
* expect to have to create entries it. Then fix its perms
|
||||||
* once we've done the traversal. */
|
* 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);
|
com_err("rdump", errno, "while making directory %s", fullname);
|
||||||
goto errout;
|
goto errout;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue