diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2024-11-27 16:16:29 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-27 16:16:29 +0100 |
commit | 288b9acf1c906047c16e5c84e1c33c09c76f2a69 (patch) | |
tree | 252e88f2af55414888117e8447d000aef3e0343f /src/basic | |
parent | service: don't second guess invocation mode again (diff) | |
parent | shared/bootspec: mark _to_string funcs as _const_ (diff) | |
download | systemd-main.tar.xz systemd-main.zip |
Diffstat (limited to 'src/basic')
-rw-r--r-- | src/basic/fileio.c | 3 | ||||
-rw-r--r-- | src/basic/fileio.h | 10 |
2 files changed, 6 insertions, 7 deletions
diff --git a/src/basic/fileio.c b/src/basic/fileio.c index 52a29e2f7b..2d29c384cc 100644 --- a/src/basic/fileio.c +++ b/src/basic/fileio.c @@ -322,8 +322,7 @@ int write_string_file_full( mode_t mode = write_string_file_flags_to_mode(flags); if (FLAGS_SET(flags, WRITE_STRING_FILE_LABEL|WRITE_STRING_FILE_CREATE)) { - const char *lookup = label_fn ? label_fn : fn; - r = label_ops_pre(dir_fd, lookup, mode); + r = label_ops_pre(dir_fd, label_fn ?: fn, mode); if (r < 0) goto fail; diff --git a/src/basic/fileio.h b/src/basic/fileio.h index 08017f8270..71ec6ba921 100644 --- a/src/basic/fileio.h +++ b/src/basic/fileio.h @@ -49,15 +49,15 @@ FILE* fmemopen_unlocked(void *buf, size_t size, const char *mode); int write_string_stream_full(FILE *f, const char *line, WriteStringFileFlags flags, const struct timespec *ts); static inline int write_string_stream(FILE *f, const char *line, WriteStringFileFlags flags) { - return write_string_stream_full(f, line, flags, /* ts= */ NULL); + return write_string_stream_full(f, line, flags, NULL); } int write_string_file_full(int dir_fd, const char *fn, const char *line, WriteStringFileFlags flags, const struct timespec *ts, const char *label_fn); -static inline int write_string_file(const char *fn, const char *line, WriteStringFileFlags flags) { - return write_string_file_full(AT_FDCWD, fn, line, flags, /* ts= */ NULL, /*label_fn=*/ NULL); -} static inline int write_string_file_at(int dir_fd, const char *fn, const char *line, WriteStringFileFlags flags) { - return write_string_file_full(dir_fd, fn, line, flags, /* ts= */ NULL, /*label_fn=*/ NULL); + return write_string_file_full(dir_fd, fn, line, flags, NULL, NULL); +} +static inline int write_string_file(const char *fn, const char *line, WriteStringFileFlags flags) { + return write_string_file_at(AT_FDCWD, fn, line, flags); } int write_string_filef(const char *fn, WriteStringFileFlags flags, const char *format, ...) _printf_(3, 4); |