summaryrefslogtreecommitdiff
path: root/src/basic/tmpfile-util.h
diff options
context:
space:
mode:
authorDaan De Meyer <daan.j.demeyer@gmail.com>2022-11-17 14:12:48 +0100
committerDaan De Meyer <daan.j.demeyer@gmail.com>2022-11-17 14:14:31 +0100
commitdd3c82529472b891c58995fca1f36686c45f856b (patch)
tree74a55d1cb82a122be25215c6c40a174d5b5bdf1c /src/basic/tmpfile-util.h
parent305dd91adfde332e7e5c1b2470edb32774f9a032 (diff)
downloadsystemd-dd3c82529472b891c58995fca1f36686c45f856b.tar.gz
tmpfile-util: Introduce fopen_temporary_child()
Instead of having fopen_temporary() create the file either next to an existing file or in tmp/, let's split this up clearly into two different functions, one for creating temporary files next to existing files, and one for creating a temporary file in a directory.
Diffstat (limited to 'src/basic/tmpfile-util.h')
-rw-r--r--src/basic/tmpfile-util.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/basic/tmpfile-util.h b/src/basic/tmpfile-util.h
index 4af28b9da3..e5b7709e3f 100644
--- a/src/basic/tmpfile-util.h
+++ b/src/basic/tmpfile-util.h
@@ -8,6 +8,12 @@ int fopen_temporary_at(int dir_fd, const char *path, FILE **ret_file, char **ret
static inline int fopen_temporary(const char *path, FILE **ret_file, char **ret_path) {
return fopen_temporary_at(AT_FDCWD, path, ret_file, ret_path);
}
+
+int fopen_temporary_child_at(int dir_fd, const char *path, FILE **ret_file, char **ret_path);
+static inline int fopen_temporary_child(const char *path, FILE **ret_file, char **ret_path) {
+ return fopen_temporary_child_at(AT_FDCWD, path, ret_file, ret_path);
+}
+
int mkostemp_safe(char *pattern);
int fmkostemp_safe(char *pattern, const char *mode, FILE**_f);