env-file: rework write_env_file() to make use of O_TMPFILE
This commit is contained in:
committed by
Yu Watanabe
parent
dfc9fd0147
commit
c450027d14
@@ -29,7 +29,10 @@ int open_tmpfile_linkable_at(int dir_fd, const char *target, int flags, char **r
|
||||
static inline int open_tmpfile_linkable(const char *target, int flags, char **ret_path) {
|
||||
return open_tmpfile_linkable_at(AT_FDCWD, target, flags, ret_path);
|
||||
}
|
||||
int fopen_tmpfile_linkable(const char *target, int flags, char **ret_path, FILE **ret_file);
|
||||
int fopen_tmpfile_linkable_at(int dir_fd, const char *target, int flags, char **ret_path, FILE **ret_file);
|
||||
static inline int fopen_tmpfile_linkable(const char *target, int flags, char **ret_path, FILE **ret_file) {
|
||||
return fopen_tmpfile_linkable_at(AT_FDCWD, target, flags, ret_path, ret_file);
|
||||
}
|
||||
|
||||
typedef enum LinkTmpfileFlags {
|
||||
LINK_TMPFILE_REPLACE = 1 << 0,
|
||||
@@ -40,7 +43,10 @@ int link_tmpfile_at(int fd, int dir_fd, const char *path, const char *target, Li
|
||||
static inline int link_tmpfile(int fd, const char *path, const char *target, LinkTmpfileFlags flags) {
|
||||
return link_tmpfile_at(fd, AT_FDCWD, path, target, flags);
|
||||
}
|
||||
int flink_tmpfile(FILE *f, const char *path, const char *target, LinkTmpfileFlags flags);
|
||||
int flink_tmpfile_at(FILE *f, int dir_fd, const char *path, const char *target, LinkTmpfileFlags flags);
|
||||
static inline int flink_tmpfile(FILE *f, const char *path, const char *target, LinkTmpfileFlags flags) {
|
||||
return flink_tmpfile_at(f, AT_FDCWD, path, target, flags);
|
||||
}
|
||||
|
||||
int mkdtemp_malloc(const char *template, char **ret);
|
||||
int mkdtemp_open(const char *template, int flags, char **ret);
|
||||
|
||||
Reference in New Issue
Block a user