diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2021-05-06 10:03:13 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2021-05-06 10:03:13 +0000 |
commit | 3bf2f9e26771eae5657243471227f975cc990797 (patch) | |
tree | fc004024bedb651094ba973eccd5945e2c3ad69c /src/daemontools-extras | |
parent | 110a803ae125047d6251827ae7c0a1e343fda84c (diff) | |
download | s6-3bf2f9e26771eae5657243471227f975cc990797.tar.gz s6-3bf2f9e26771eae5657243471227f975cc990797.tar.xz s6-3bf2f9e26771eae5657243471227f975cc990797.zip |
bugfix: rare fd leak in s6-log
Diffstat (limited to 'src/daemontools-extras')
-rw-r--r-- | src/daemontools-extras/s6-log.c | 8 |
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) ; |