diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2021-09-02 14:57:18 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2021-09-02 14:59:32 -0400 |
commit | 6b083345307aa1fdbc48eaf247c80b4c4982b2ee (patch) | |
tree | 4fb5102e11f12dede475619bad3872e3595a8161 /eval.c | |
parent | 302e9987fe732e7e4154386058fff2720fc68fc3 (diff) | |
download | bfs-6b083345307aa1fdbc48eaf247c80b4c4982b2ee.tar.xz |
eval: Use 512-byte blocks for -ls when POSIXLY_CORRECT is set
This matches the behaviour of GNU find, and allows bfs to match the
output of BSD find as well. Fixes #77.
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -644,7 +644,8 @@ bool eval_fls(const struct expr *expr, struct eval_state *state) { } uintmax_t ino = statbuf->ino; - uintmax_t blocks = ((uintmax_t)statbuf->blocks*BFS_STAT_BLKSIZE + 1023)/1024; + uintmax_t block_size = state->ctx->posixly_correct ? 512 : 1024; + uintmax_t blocks = ((uintmax_t)statbuf->blocks*BFS_STAT_BLKSIZE + block_size - 1)/block_size; char mode[11]; xstrmode(statbuf->mode, mode); char acl = bfs_check_acl(ftwbuf) > 0 ? '+' : ' '; |