aboutsummaryrefslogtreecommitdiff
path: root/e2fsprogs/lsattr.c
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2022-05-19 12:34:34 +0100
committerRon Yorston <rmy@pobox.com>2022-05-19 15:43:23 +0100
commit6ba1bb6d0245ecfca39224a44e2b3af3b2fef3d3 (patch)
treede44a134c030c9d1ebb342ab6ae066184cb90b58 /e2fsprogs/lsattr.c
parent342f35e6c8ad13dad931af7858f64c8a7f63d08f (diff)
downloadbusybox-w32-6ba1bb6d0245ecfca39224a44e2b3af3b2fef3d3.tar.gz
busybox-w32-6ba1bb6d0245ecfca39224a44e2b3af3b2fef3d3.tar.bz2
busybox-w32-6ba1bb6d0245ecfca39224a44e2b3af3b2fef3d3.zip
chattr,lsattr: code shrink
Drop fgetsetflags() and move its functionality into chattr and lsattr. Raw file attributes are available from struct stat. In chattr don't compile code related to the unused (on Windows) OPT_SET option.
Diffstat (limited to '')
-rw-r--r--e2fsprogs/lsattr.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/e2fsprogs/lsattr.c b/e2fsprogs/lsattr.c
index d82861e14..461ce39e6 100644
--- a/e2fsprogs/lsattr.c
+++ b/e2fsprogs/lsattr.c
@@ -89,8 +89,13 @@ static void list_attributes(const char *name)
89 89
90 close(fd); 90 close(fd);
91#else /* ENABLE_PLATFORM_MINGW32 */ 91#else /* ENABLE_PLATFORM_MINGW32 */
92 if (fgetflags(name, &fsflags) != 0) 92 struct stat st;
93
94 if (lstat(name, &st) == 0 && !(S_ISREG(st.st_mode) ||
95 S_ISDIR(st.st_mode) || S_ISLNK(st.st_mode)))
93 goto read_err; 96 goto read_err;
97
98 fsflags = st.st_attr;
94#endif 99#endif
95 100
96 if (option_mask32 & OPT_PF_LONG) { 101 if (option_mask32 & OPT_PF_LONG) {