diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2020-10-25 13:44:43 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2020-11-10 15:52:32 +0100 |
commit | 4d5f52e77e1978a4f07fca2a1ecae45d5c5979c1 (patch) | |
tree | 52d71de661550be511ba26e8e1085c94d1969fa7 /src | |
parent | b5c474f69b473ba752ac9e63ff961f94341dc828 (diff) | |
download | systemd-4d5f52e77e1978a4f07fca2a1ecae45d5c5979c1.tar.gz |
basic/fileio: constify struct timespec arguments
Diffstat (limited to 'src')
-rw-r--r-- | src/basic/fileio.c | 8 | ||||
-rw-r--r-- | src/basic/fileio.h | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/basic/fileio.c b/src/basic/fileio.c index 71a2654507..973756c891 100644 --- a/src/basic/fileio.c +++ b/src/basic/fileio.c @@ -117,7 +117,7 @@ int write_string_stream_ts( FILE *f, const char *line, WriteStringFileFlags flags, - struct timespec *ts) { + const struct timespec *ts) { bool needs_nl; int r, fd; @@ -161,7 +161,7 @@ int write_string_stream_ts( return r; if (ts) { - struct timespec twice[2] = {*ts, *ts}; + const struct timespec twice[2] = {*ts, *ts}; if (futimens(fd, twice) < 0) return -errno; @@ -174,7 +174,7 @@ static int write_string_file_atomic( const char *fn, const char *line, WriteStringFileFlags flags, - struct timespec *ts) { + const struct timespec *ts) { _cleanup_fclose_ FILE *f = NULL; _cleanup_free_ char *p = NULL; @@ -221,7 +221,7 @@ int write_string_file_ts( const char *fn, const char *line, WriteStringFileFlags flags, - struct timespec *ts) { + const struct timespec *ts) { _cleanup_fclose_ FILE *f = NULL; int q, r, fd; diff --git a/src/basic/fileio.h b/src/basic/fileio.h index b34ed5e88b..0886354cbc 100644 --- a/src/basic/fileio.h +++ b/src/basic/fileio.h @@ -48,11 +48,11 @@ DIR* take_fdopendir(int *dfd); FILE* open_memstream_unlocked(char **ptr, size_t *sizeloc); FILE* fmemopen_unlocked(void *buf, size_t size, const char *mode); -int write_string_stream_ts(FILE *f, const char *line, WriteStringFileFlags flags, struct timespec *ts); +int write_string_stream_ts(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_ts(f, line, flags, NULL); } -int write_string_file_ts(const char *fn, const char *line, WriteStringFileFlags flags, struct timespec *ts); +int write_string_file_ts(const char *fn, const char *line, WriteStringFileFlags flags, const struct timespec *ts); static inline int write_string_file(const char *fn, const char *line, WriteStringFileFlags flags) { return write_string_file_ts(fn, line, flags, NULL); } |