diff options
author | Mike Frysinger <vapier@gentoo.org> | 2012-03-07 00:25:41 -0500 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2012-03-07 00:28:01 -0500 |
commit | 1860d33fc9c9d05907db9bf02f1c81e0f517c09f (patch) | |
tree | 2aa929708d150e1d05bd179c8d0b0a4bb2eb8940 /libsandbox | |
parent | libsandbox: mark internal fds with O_CLOEXEC (diff) | |
download | sandbox-1860d33fc9c9d05907db9bf02f1c81e0f517c09f.tar.gz sandbox-1860d33fc9c9d05907db9bf02f1c81e0f517c09f.tar.bz2 sandbox-1860d33fc9c9d05907db9bf02f1c81e0f517c09f.zip |
libsandbox: add missing close to logfile fd
When we log a lot, we end up leaking fd's, so make sure to clean them.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'libsandbox')
-rw-r--r-- | libsandbox/libsandbox.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libsandbox/libsandbox.c b/libsandbox/libsandbox.c index 77a2415..e0b291a 100644 --- a/libsandbox/libsandbox.c +++ b/libsandbox/libsandbox.c @@ -468,6 +468,7 @@ static bool write_logfile(const char *logfile, const char *func, const char *pat struct stat log_stat; int stat_ret; int logfd; + bool ret = false; stat_ret = lstat(logfile, &log_stat); /* Do not care about failure */ @@ -523,10 +524,12 @@ static bool write_logfile(const char *logfile, const char *func, const char *pat } _SB_WRITE_STR("\n"); - return true; + ret = true; error: - return false; + sb_close(logfd); + + return ret; } static void init_context(sbcontext_t *context) |