From c3f9dfe79b0eccf9b87a5cd6a0b3b1b62f964348 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Tue, 29 Jan 2019 21:57:46 +0000 Subject: Revert truncate() change in s6-log (thanks obarun for the report) --- src/daemontools-extras/s6-log.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') 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: -- cgit v1.2.3