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.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2022-11-08 18:21:10 +01:00
parent 3ae6b3bf72
commit db62f51a9f
2 changed files with 3 additions and 4 deletions
+2 -3
View File
@@ -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;
+1 -1
View File
@@ -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);