mirror of
https://github.com/troglobit/finit.git
synced 2026-11-23 20:11:44 +00:00
tmpfiles: skip an entry that is not supported, do not exit
tmpfiles exited at the first entry with a type it does not know, or
with a % specifier in the path:
h /tmp/dir - - - - +i
f /tmp/dir/after
tmpfiles --create t.conf
This never created /tmp/dir/after. At boot it meant that one such
line, in any tmpfiles.d file, stopped every entry after it, in that
file and in all the files sorted after it. The message says skipping,
but errx() exits.
Warn and go on with the next entry. With two passes, for --create
with --remove, only the second one warns.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
4 files changed
+52
-3
No files matched your search
+11
-3
@@ -56,6 +56,9 @@ int create_flag = 0;
|
||||
int clean_flag = 0;
|
||||
int remove_flag = 0;
|
||||
|
||||
/* Set for the first of two passes, the second one does the complaining */
|
||||
static int quiet;
|
||||
|
||||
#define MAX_EXCLUDES 32
|
||||
static const char *exclude_prefixes[MAX_EXCLUDES];
|
||||
static int num_excludes;
|
||||
@@ -727,7 +730,8 @@ static void tmpfiles(char *line)
|
||||
if (!path)
|
||||
return;
|
||||
if (strchr(path, '%')) {
|
||||
errx(1, "Path name specifiers unsupported, skipping.");
|
||||
if (!quiet)
|
||||
warnx("Path name specifiers unsupported, skipping %s", path);
|
||||
return;
|
||||
}
|
||||
if (excluded(path))
|
||||
@@ -796,7 +800,8 @@ static void tmpfiles(char *line)
|
||||
case 'z':
|
||||
break;
|
||||
default:
|
||||
errx(1, "Unsupported tmpfiles command '%s'", type);
|
||||
if (!quiet)
|
||||
warnx("Unsupported tmpfiles command '%s', skipping %s", type, path);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1037,7 +1042,8 @@ static void tmpfiles(char *line)
|
||||
globfree(&gl);
|
||||
break;
|
||||
default:
|
||||
errx(1, "Unsupported tmpfiles command '%s'", type);
|
||||
if (!quiet)
|
||||
warnx("Unsupported tmpfiles command '%s', skipping %s", type, path);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1214,8 +1220,10 @@ int main(int argc, char *argv[])
|
||||
/* Remove and clean first, or an r entry takes what an f entry above it made */
|
||||
if (create_flag && (clean_flag || remove_flag)) {
|
||||
create_flag = 0;
|
||||
quiet = 1;
|
||||
process(argc - optind, &argv[optind]);
|
||||
create_flag = 1;
|
||||
quiet = 0;
|
||||
clean_flag = remove_flag = 0;
|
||||
}
|
||||
process(argc - optind, &argv[optind]);
|
||||
|
||||
Reference in new issue
Block a user