fileio: port write_string_file() to LabelOps, and thus add WRITE_STRING_FILE_LABEL flag

Given that we have the LabelOps abstraction these days, we can teach
write_string_file() to use it, which means we can get rid of
fileio-label.[ch] as a separate concept.

(The only reason that fileio-label.[ch] exists independently of
fileio.[ch] was that the former linekd to libselinux potentially, and
thus had to be in src/shared/ while the other always was in src/basic/.
But the LabelOps vtable provides us with a nice work-around)
This commit is contained in:
Lennart Poettering
2024-10-22 17:51:26 +02:00
parent 4946dd4197
commit 8eeb870971
13 changed files with 84 additions and 74 deletions
+1 -2
View File
@@ -29,7 +29,6 @@
#include "exec-credential.h"
#include "execute.h"
#include "fd-util.h"
#include "fileio-label.h"
#include "fileio.h"
#include "format-util.h"
#include "id128-util.h"
@@ -4620,7 +4619,7 @@ int unit_write_setting(Unit *u, UnitWriteFlags flags, const char *name, const ch
return r;
}
r = write_string_file_atomic_label(q, wrapped);
r = write_string_file(q, wrapped, WRITE_STRING_FILE_CREATE|WRITE_STRING_FILE_ATOMIC|WRITE_STRING_FILE_LABEL);
if (r < 0)
return r;