diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2019-01-29 21:57:46 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2019-01-29 21:57:46 +0000 |
commit | c3f9dfe79b0eccf9b87a5cd6a0b3b1b62f964348 (patch) | |
tree | 1be82daad679d286851fa7daa5704b17f77d32ae | |
parent | 0070815b71e9a583d11d5c4e001f676708e77963 (diff) | |
download | s6-c3f9dfe79b0eccf9b87a5cd6a0b3b1b62f964348.tar.xz |
Revert truncate() change in s6-log (thanks obarun for the report)
-rw-r--r-- | src/daemontools-extras/s6-log.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/daemontools-extras/s6-log.c b/src/daemontools-extras/s6-log.c index b849f53..c3360f4 100644 --- a/src/daemontools-extras/s6-log.c +++ b/src/daemontools-extras/s6-log.c @@ -614,7 +614,9 @@ static inline void logdir_init (unsigned int index, uint32_t s, uint32_t n, uint if (finish(ldp, "current", 'u') < 0) strerr_diefu2sys(111, "finish current .u for logdir ", ldp->dir) ; memcpy(x + dirlen + 1, "state", 6) ; - if (truncate(x, 0) == -1) strerr_diefu2sys(111, "truncate ", x) ; + r = open_trunc(x) ; + if (r == -1) strerr_diefu2sys(111, "open_trunc ", x) ; + fd_close(r) ; st.st_size = 0 ; memcpy(x + dirlen + 1, "current", 8) ; opencurrent: |