diff options
-rw-r--r-- | e2fsprogs/chattr.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/e2fsprogs/chattr.c b/e2fsprogs/chattr.c index 1b12c9f37..e599abae7 100644 --- a/e2fsprogs/chattr.c +++ b/e2fsprogs/chattr.c | |||
@@ -141,6 +141,8 @@ static void change_attributes(const char *name, struct globals *gp); | |||
141 | 141 | ||
142 | static int FAST_FUNC chattr_dir_proc(const char *dir_name, struct dirent *de, void *gp) | 142 | static int FAST_FUNC chattr_dir_proc(const char *dir_name, struct dirent *de, void *gp) |
143 | { | 143 | { |
144 | //TODO: use de->d_type (if it's not DT_UNKNOWN) to skip !(REG || DIR || LNK) entries without lstat? | ||
145 | |||
144 | char *path = concat_subpath_file(dir_name, de->d_name); | 146 | char *path = concat_subpath_file(dir_name, de->d_name); |
145 | /* path is NULL if de->d_name is "." or "..", else... */ | 147 | /* path is NULL if de->d_name is "." or "..", else... */ |
146 | if (path) { | 148 | if (path) { |
@@ -184,12 +186,14 @@ static void change_attributes(const char *name, struct globals *gp) | |||
184 | struct ext2_fsxattr fsxattr; | 186 | struct ext2_fsxattr fsxattr; |
185 | r = ioctl(fd, EXT2_IOC_FSGETXATTR, &fsxattr); | 187 | r = ioctl(fd, EXT2_IOC_FSGETXATTR, &fsxattr); |
186 | /* note: ^^^ may fail in 32-bit userspace on 64-bit kernel (seen on 4.12.0) */ | 188 | /* note: ^^^ may fail in 32-bit userspace on 64-bit kernel (seen on 4.12.0) */ |
187 | if (r != 0) | 189 | if (r != 0) { |
188 | bb_perror_msg("getting %s on %s", "project ID", name); | 190 | bb_perror_msg("getting %s on %s", "project ID", name); |
189 | fsxattr.fsx_projid = gp->projid; | 191 | } else { |
190 | r = ioctl(fd, EXT2_IOC_FSSETXATTR, &fsxattr); | 192 | fsxattr.fsx_projid = gp->projid; |
191 | if (r != 0) | 193 | r = ioctl(fd, EXT2_IOC_FSSETXATTR, &fsxattr); |
192 | bb_perror_msg("setting %s on %s", "project ID", name); | 194 | if (r != 0) |
195 | bb_perror_msg("setting %s on %s", "project ID", name); | ||
196 | } | ||
193 | } | 197 | } |
194 | 198 | ||
195 | if (gp->flags & OPT_SET) { | 199 | if (gp->flags & OPT_SET) { |