bootctl: create loader.conf only if it doesn't exist yet
If the snippet aleady exists, don't do anything, as the file was already installed then. (This also reworks the code to create the file atomically) Fixes: #5396
This commit is contained in:
@@ -91,3 +91,9 @@ static inline void rmdir_and_free(char *p) {
|
||||
free(p);
|
||||
}
|
||||
DEFINE_TRIVIAL_CLEANUP_FUNC(char*, rmdir_and_free);
|
||||
|
||||
static inline void unlink_and_free(char *p) {
|
||||
(void) unlink(p);
|
||||
free(p);
|
||||
}
|
||||
DEFINE_TRIVIAL_CLEANUP_FUNC(char*, unlink_and_free);
|
||||
|
||||
Reference in New Issue
Block a user