From: Zbigniew Jędrzejewski-Szmek Date: Sun, 6 Nov 2022 17:41:48 +0000 (+0100) Subject: basic/filesystems: fs_in_group() returns a boolean X-Git-Tag: v253-rc1~572^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=db62f51a9f7bc881a0363b8f57c181808bb1d379;p=thirdparty%2Fsystemd.git basic/filesystems: fs_in_group() returns a boolean is_{temporary,network}_fs() looked like they are incorrectly casting an error to true, but actually the return type is misdeclared. --- diff --git a/src/basic/filesystems.c b/src/basic/filesystems.c index 0f71f8e07cd..b11cbb9d65a 100644 --- a/src/basic/filesystems.c +++ b/src/basic/filesystems.c @@ -27,7 +27,7 @@ int fs_type_from_string(const char *name, const statfs_f_type_t **ret) { return 0; } -int fs_in_group(const struct statfs *s, FilesystemGroups fs_group) { +bool fs_in_group(const struct statfs *s, FilesystemGroups fs_group) { const char *fs; int r; @@ -35,7 +35,7 @@ int fs_in_group(const struct statfs *s, FilesystemGroups fs_group) { const statfs_f_type_t *magic; r = fs_type_from_string(fs, &magic); - if (r == 0) { + if (r >= 0) for (size_t i = 0; i < FILESYSTEM_MAGIC_MAX; i++) { if (magic[i] == 0) break; @@ -43,7 +43,6 @@ int fs_in_group(const struct statfs *s, FilesystemGroups fs_group) { if (is_fs_type(s, magic[i])) return true; } - } } return false; diff --git a/src/basic/filesystems.h b/src/basic/filesystems.h index 6d07a97ba7c..f9edbc1f292 100644 --- a/src/basic/filesystems.h +++ b/src/basic/filesystems.h @@ -36,7 +36,7 @@ const FilesystemSet *filesystem_set_find(const char *name); const char *fs_type_to_string(statfs_f_type_t magic); int fs_type_from_string(const char *name, const statfs_f_type_t **ret); -int fs_in_group(const struct statfs *s, enum FilesystemGroups fs_group); +bool fs_in_group(const struct statfs *s, enum FilesystemGroups fs_group); /* gperf prototypes */ const struct FilesystemMagic* filesystems_gperf_lookup(const char *key, GPERF_LEN_TYPE length);