summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2021-05-06 10:03:13 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2021-05-06 10:03:13 +0000
commit3bf2f9e26771eae5657243471227f975cc990797 (patch)
treefc004024bedb651094ba973eccd5945e2c3ad69c /src
parent110a803ae125047d6251827ae7c0a1e343fda84c (diff)
downloads6-3bf2f9e26771eae5657243471227f975cc990797.tar.xz
bugfix: rare fd leak in s6-log
Diffstat (limited to 'src')
-rw-r--r--src/daemontools-extras/s6-log.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/daemontools-extras/s6-log.c b/src/daemontools-extras/s6-log.c
index 798422d..29debb3 100644
--- 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) ;