about summary refs log tree commit diff
path: root/src/daemontools-extras/s6-log.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/daemontools-extras/s6-log.c')
-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) ;