aboutsummaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2019-08-19 19:30:15 -0500
committerRob Landley <rob@landley.net>2019-08-19 19:30:15 -0500
commitb66fa58328888998b9085d379d8a40c1b23588fa (patch)
tree54543ae486851ad89969561b1853f46c8b9889a7 /toys
parent4e1f3a4a7038e145b11acbfbd87ecd50111d8dfd (diff)
downloadtoybox-b66fa58328888998b9085d379d8a40c1b23588fa.tar.gz
Tiny cleanup, net two lines shorter.
Diffstat (limited to 'toys')
-rw-r--r--toys/other/lsattr.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/toys/other/lsattr.c b/toys/other/lsattr.c
index ec7d88e5..5a102011 100644
--- a/toys/other/lsattr.c
+++ b/toys/other/lsattr.c
@@ -288,15 +288,13 @@ static int update_attr(struct dirtree *root)
if (ext2_setflag(fd, &(root->st), fval) < 0)
perror_msg("setting flags '%s'", fpath);
}
- if (chattr.vflag) { // set file version
- if (ioctl(fd, FS_IOC_SETVERSION, (void*)&chattr.version) < 0)
- perror_msg("while setting version on '%s'", fpath);
- }
+ // set file version
+ if (chattr.vflag && (ioctl(fd, FS_IOC_SETVERSION, &chattr.version)<0))
+ perror_msg("while setting version on '%s'", fpath);
free(fpath);
xclose(fd);
- if (S_ISDIR(root->st.st_mode) && chattr.recursive) return DIRTREE_RECURSE;
- return 0;
+ return (S_ISDIR(root->st.st_mode) && chattr.recursive) ? DIRTREE_RECURSE : 0;
}
void chattr_main(void)