generator: optionally return resulting unit file path in generator_open_unit_file_full()

This is useful if we want to make symlinks to it later.
This commit is contained in:
Lennart Poettering
2024-01-11 16:05:20 +01:00
parent 78cdb9b50a
commit 7ceb76b63c
3 changed files with 28 additions and 5 deletions
+5
View File
@@ -29,6 +29,7 @@ int generator_open_unit_file_full(
const char *source,
const char *fn,
FILE **ret_file,
char **ret_final_path,
char **ret_temp_path) {
_cleanup_free_ char *p = NULL;
@@ -72,6 +73,10 @@ int generator_open_unit_file_full(
program_invocation_short_name);
*ret_file = f;
if (ret_final_path)
*ret_final_path = TAKE_PTR(p);
return 0;
}
+2 -2
View File
@@ -6,10 +6,10 @@
#include "macro.h"
#include "main-func.h"
int generator_open_unit_file_full(const char *dest, const char *source, const char *name, FILE **ret_file, char **ret_temp_path);
int generator_open_unit_file_full(const char *dest, const char *source, const char *name, FILE **ret_file, char **ret_final_path, char **ret_temp_path);
static inline int generator_open_unit_file(const char *dest, const char *source, const char *name, FILE **ret_file) {
return generator_open_unit_file_full(dest, source, name, ret_file, NULL);
return generator_open_unit_file_full(dest, source, name, ret_file, NULL, NULL);
}
int generator_add_symlink_full(const char *dir, const char *dst, const char *dep_type, const char *src, const char *instance);