Whamcloud - gitweb
misc/e4defrag: fix -Wstringop-truncation warnings
authorEric Biggers <ebiggers@google.com>
Sat, 21 Jan 2023 20:32:21 +0000 (12:32 -0800)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 27 Jan 2023 17:38:31 +0000 (12:38 -0500)
commit58830e58551aef70e19c992f880e378125e5d9d9
treeba2fb9d44f9d7640e03bee36f1978614c15102af
parenteb5ebbc777023f7172b9ce4338dfe816eb4b1aa3
misc/e4defrag: fix -Wstringop-truncation warnings

Fix two -Wstringop-truncation warnings in is_ext4() by simplifying how
how mnt_type is handled and by using the correct bound for mnt_fsname.

Fix a -Wstringop-truncation warning in main() by replacing the fragile
pattern 'strncpy(dst, src, strnlen(src, N))', which doesn't
null-terminate the destination string, with a standard string copy.  (It
happened to work anyway because dst happens to be zero-initialized.)

These warnings showed up when building with -Wall with gcc 8 or later.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
misc/e4defrag.c