diff options
author | Rob Landley <rob@landley.net> | 2023-03-03 15:21:06 -0600 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2023-03-03 15:21:06 -0600 |
commit | b367482e9c102f49001a7e2d1ddb048bdce8b06e (patch) | |
tree | f4c498463564b545fcee9408899925db8dc2d29a /toys/posix/touch.c | |
parent | 078e95bba4fa0ce2aaf3e17502bba05b8551a93d (diff) | |
download | toybox-b367482e9c102f49001a7e2d1ddb048bdce8b06e.tar.gz |
Change FLAG(x) macros to always return 0 or 1. Treewide audit of FLAG()
users to make sure nobody NEEDED FLAG(x) to return the masked bit value,
and to remove now-redundant !!, with a number of in-passing cleanups
while I was there.
I think I fixed an actual bug in patch.c (-R depended on the flag value
but commit 6f6b7614e463 changed it, so "+-"[FLAG(R)] was comparing
against the NUL terminator when measuring fuzz) but we didn't have a
test for "fuzz autodetection". And there was another bug in tar.c
where DIRTREE_BREADTH was assigned to a local variable... and then not
used. But the test passed? (Not sure the flag's needed at the top level,
added a comment to the test suite to remind me to revisit that.)
While I was there, capitalize TODO comments so they're easier to grep for.
Diffstat (limited to 'toys/posix/touch.c')
-rw-r--r-- | toys/posix/touch.c | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/toys/posix/touch.c b/toys/posix/touch.c index 5e33d7f7..e687ff81 100644 --- a/toys/posix/touch.c +++ b/toys/posix/touch.c @@ -71,7 +71,6 @@ void touch_main(void) if (!strcmp(s, "-")) { if (!futimens(1, ts)) continue; } else { - // cheat: FLAG_h is rightmost flag, so its value is 1 if (!utimensat(AT_FDCWD, s, ts, FLAG(h)*AT_SYMLINK_NOFOLLOW)) continue; if (FLAG(c)) continue; if (access(s, F_OK) && (-1!=(fd = open(s, O_CREAT, 0666)))) { |