commit 3bf2f9e26771eae5657243471227f975cc990797
parent 110a803ae125047d6251827ae7c0a1e343fda84c
Author: Laurent Bercot <ska-skaware@skarnet.org>
Date: Thu, 6 May 2021 10:03:13 +0000
bugfix: rare fd leak in s6-log
Diffstat:
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/daemontools-extras/s6-log.c b/src/daemontools-extras/s6-log.c
@@ -226,8 +226,14 @@ static inline int logdir_trim (logdir_t *ldp)
dir_close(dir) ;
return -1 ;
}
+ if (!n)
+ {
+ dir_close(dir) ;
+ return 0 ;
+ }
+
rewinddir(dir) ;
- if (n)
+
{
uint64_t totalsize = 0 ;
size_t dirlen = strlen(ldp->dir) ;