Blame SOURCES/cyrus-imapd-close_backup_fd_on_error.patch

020be8
From 725e1efbd923c6d15ba639e17bfd0baabc619daa Mon Sep 17 00:00:00 2001
020be8
From: Pavel Zhukov <pzhukov@redhat.com>
020be8
Date: Mon, 1 Oct 2018 15:55:35 +0200
020be8
Subject: [PATCH] Close file descriptior in case of error
020be8
020be8
Make static code analizers happy.
020be8
If stat() failed for some reason it may lead backup fd unclosed.
020be8
---
020be8
 backup/lcb.c | 1 +
020be8
 1 file changed, 1 insertion(+)
020be8
020be8
diff --git a/backup/lcb.c b/backup/lcb.c
020be8
index 8c4a0e31a..9a04b08f2 100644
020be8
--- a/backup/lcb.c
020be8
+++ b/backup/lcb.c
020be8
@@ -182,6 +182,7 @@ HIDDEN int backup_real_open(struct backup **backupp,
020be8
         if (r) {
020be8
             syslog(LOG_ERR, "IOERROR: (f)stat %s: %m", backup->data_fname);
020be8
             r = IMAP_IOERROR;
020be8
+            close(fd);
020be8
             goto error;
020be8
         }
020be8