commit c3f9dfe79b0eccf9b87a5cd6a0b3b1b62f964348
parent 0070815b71e9a583d11d5c4e001f676708e77963
Author: Laurent Bercot <ska-skaware@skarnet.org>
Date: Tue, 29 Jan 2019 21:57:46 +0000
Revert truncate() change in s6-log (thanks obarun for the report)
Diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git 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: