mirror of
https://github.com/clearlinux/systemd-stable.git
synced 2026-06-16 02:35:58 +00:00
journald: fix fd leak in journal_file_empty
Before my previous patch, journal_file_empty wasn't be called with the correct filename. Now that it's being called with the correct filename it leaks file descriptors. This patch closes the file descriptors before returning. Signed-off-by: George McCollister <george.mccollister@gmail.com> [Edit harald@redhat.com: make use of _cleanup_close_ instead]
This commit is contained in:
committed by
Zbigniew Jędrzejewski-Szmek
parent
1fc56e5b7f
commit
4d28dc9086
@@ -129,8 +129,9 @@ static void patch_realtime(
|
||||
}
|
||||
|
||||
static int journal_file_empty(int dir_fd, const char *name) {
|
||||
int fd, r;
|
||||
int r;
|
||||
le64_t n_entries;
|
||||
_cleanup_close_ int fd;
|
||||
|
||||
fd = openat(dir_fd, name, O_RDONLY|O_CLOEXEC|O_NOFOLLOW|O_NONBLOCK);
|
||||
if (fd < 0)
|
||||
|
||||
Reference in New Issue
Block a user