0895e87348e5fc02f50498cad5922eb3eb172323 removed the last (only?) use of
CAT_MAIN_FILE_OPTIONAL, except for tests. All callers first check if the main
file exists on their own, so this code was effectively dead.
I want to repopulate the enum in later commits, so a dummy flag is added
to allow the code to compile.
if (file) {
r = cat_file(file, false);
- if (r == -ENOENT && (flags & CAT_FLAGS_MAIN_FILE_OPTIONAL))
- printf("%s# Configuration file %s not found%s\n",
- ansi_highlight_magenta(),
- file,
- ansi_normal());
- else if (r < 0)
+ if (r < 0)
return log_warning_errno(r, "Failed to cat %s: %m", file);
}
int terminal_urlify_man(const char *page, const char *section, char **ret);
typedef enum CatFlags {
- CAT_FLAGS_MAIN_FILE_OPTIONAL = 1 << 0,
+ CAT_DUMMY_FLAG, // This flag only exists a as a placeholder because empty enums are not allowed
} CatFlags;
int cat_files(const char *file, char **dropins, CatFlags flags);
TEST(cat_files) {
assert_se(cat_files("/no/such/file", NULL, 0) == -ENOENT);
- assert_se(cat_files("/no/such/file", NULL, CAT_FLAGS_MAIN_FILE_OPTIONAL) == 0);
+ assert_se(cat_files(NULL, NULL, 0) == 0);
if (access("/etc/fstab", R_OK) >= 0)
assert_se(cat_files("/etc/fstab", STRV_MAKE("/etc/fstab", "/etc/fstab"), 0) == 0);