diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2021-06-23 15:33:22 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2021-06-23 15:33:22 +0200 |
commit | 85a5bc91487ae1b4014f2ee6595873c8330fa7a7 (patch) | |
tree | cb89536fd66325800c02a55058ee4e0d9cc07896 | |
parent | 96436fb36a5fa0ac8e993fb093b4788fb5448afe (diff) | |
download | busybox-w32-85a5bc91487ae1b4014f2ee6595873c8330fa7a7.tar.gz busybox-w32-85a5bc91487ae1b4014f2ee6595873c8330fa7a7.tar.bz2 busybox-w32-85a5bc91487ae1b4014f2ee6595873c8330fa7a7.zip |
chattr,lsattr: share stat error message
function old new delta
.rodata 103692 103684 -8
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | e2fsprogs/chattr.c | 3 | ||||
-rw-r--r-- | e2fsprogs/lsattr.c | 5 |
2 files changed, 5 insertions, 3 deletions
diff --git a/e2fsprogs/chattr.c b/e2fsprogs/chattr.c index f6a9fcf30..b424e797b 100644 --- a/e2fsprogs/chattr.c +++ b/e2fsprogs/chattr.c | |||
@@ -154,7 +154,7 @@ static void change_attributes(const char *name, struct globals *gp) | |||
154 | struct stat st; | 154 | struct stat st; |
155 | 155 | ||
156 | if (lstat(name, &st) != 0) { | 156 | if (lstat(name, &st) != 0) { |
157 | bb_perror_msg("stat %s", name); | 157 | bb_perror_msg("can't stat '%s'", name); |
158 | return; | 158 | return; |
159 | } | 159 | } |
160 | if (S_ISLNK(st.st_mode) && gp->recursive) | 160 | if (S_ISLNK(st.st_mode) && gp->recursive) |
@@ -180,6 +180,7 @@ static void change_attributes(const char *name, struct globals *gp) | |||
180 | if (gp->flags & OPT_SET_PROJ) { | 180 | if (gp->flags & OPT_SET_PROJ) { |
181 | struct ext2_fsxattr fsxattr; | 181 | struct ext2_fsxattr fsxattr; |
182 | r = ioctl(fd, EXT2_IOC_FSGETXATTR, &fsxattr); | 182 | r = ioctl(fd, EXT2_IOC_FSGETXATTR, &fsxattr); |
183 | /* note: ^^^ may fail in 32-bit userspace on 64-bit kernel (seen on 4.12.0) */ | ||
183 | if (r != 0) | 184 | if (r != 0) |
184 | bb_perror_msg("getting %s on %s", "project ID", name); | 185 | bb_perror_msg("getting %s on %s", "project ID", name); |
185 | fsxattr.fsx_projid = gp->projid; | 186 | fsxattr.fsx_projid = gp->projid; |
diff --git a/e2fsprogs/lsattr.c b/e2fsprogs/lsattr.c index 3972ce8a7..b4ed12d50 100644 --- a/e2fsprogs/lsattr.c +++ b/e2fsprogs/lsattr.c | |||
@@ -56,6 +56,7 @@ static void list_attributes(const char *name) | |||
56 | if (option_mask32 & OPT_PROJID) { | 56 | if (option_mask32 & OPT_PROJID) { |
57 | struct ext2_fsxattr fsxattr; | 57 | struct ext2_fsxattr fsxattr; |
58 | r = ioctl(fd, EXT2_IOC_FSGETXATTR, &fsxattr); | 58 | r = ioctl(fd, EXT2_IOC_FSGETXATTR, &fsxattr); |
59 | /* note: ^^^ may fail in 32-bit userspace on 64-bit kernel (seen on 4.12.0) */ | ||
59 | if (r != 0) | 60 | if (r != 0) |
60 | goto read_err; | 61 | goto read_err; |
61 | printf("%5u ", (unsigned)fsxattr.fsx_projid); | 62 | printf("%5u ", (unsigned)fsxattr.fsx_projid); |
@@ -100,7 +101,7 @@ static int FAST_FUNC lsattr_dir_proc(const char *dir_name, | |||
100 | path = concat_path_file(dir_name, de->d_name); | 101 | path = concat_path_file(dir_name, de->d_name); |
101 | 102 | ||
102 | if (lstat(path, &st) != 0) | 103 | if (lstat(path, &st) != 0) |
103 | bb_perror_msg("stat %s", path); | 104 | bb_perror_msg("can't stat '%s'", path); |
104 | else if (de->d_name[0] != '.' || (option_mask32 & OPT_ALL)) { | 105 | else if (de->d_name[0] != '.' || (option_mask32 & OPT_ALL)) { |
105 | list_attributes(path); | 106 | list_attributes(path); |
106 | if (S_ISDIR(st.st_mode) && (option_mask32 & OPT_RECUR) | 107 | if (S_ISDIR(st.st_mode) && (option_mask32 & OPT_RECUR) |
@@ -121,7 +122,7 @@ static void lsattr_args(const char *name) | |||
121 | struct stat st; | 122 | struct stat st; |
122 | 123 | ||
123 | if (lstat(name, &st) == -1) { | 124 | if (lstat(name, &st) == -1) { |
124 | bb_perror_msg("stat %s", name); | 125 | bb_perror_msg("can't stat '%s'", name); |
125 | } else if (S_ISDIR(st.st_mode) && !(option_mask32 & OPT_DIRS_OPT)) { | 126 | } else if (S_ISDIR(st.st_mode) && !(option_mask32 & OPT_DIRS_OPT)) { |
126 | iterate_on_dir(name, lsattr_dir_proc, NULL); | 127 | iterate_on_dir(name, lsattr_dir_proc, NULL); |
127 | } else { | 128 | } else { |