Blame SOURCES/0007-editing_open-close-fd-after-we-ve-established-its-va.patch

cd37fb
From e5536845298b6672a16e5866a823fcf6562c6cf3 Mon Sep 17 00:00:00 2001
cd37fb
From: Jakub Hrozek <jakub.hrozek@posteo.se>
cd37fb
Date: Wed, 26 Sep 2018 21:15:38 +0200
cd37fb
Subject: [PATCH 7/7] editing_open: close fd after we've established its
cd37fb
 validity
cd37fb
cd37fb
Merges:
cd37fb
https://pagure.io/libuser/issue/26
cd37fb
cd37fb
The code used to first close(fd) and only then check if it's != -1.
cd37fb
Reverse the logic so that the fd is only closed if valid.
cd37fb
---
cd37fb
 modules/files.c | 2 +-
cd37fb
 1 file changed, 1 insertion(+), 1 deletion(-)
cd37fb
cd37fb
diff --git a/modules/files.c b/modules/files.c
cd37fb
index 8c2a282b6448bbfb313b5d4f5eeb28b8240bccd5..b8bf8a60e5810c0b705bd91efbdf9e27e851cd2b 100644
cd37fb
--- a/modules/files.c
cd37fb
+++ b/modules/files.c
cd37fb
@@ -387,9 +387,9 @@ editing_open(struct lu_module *module, const char *file_suffix,
cd37fb
 	backup_name = g_strconcat(e->filename, "-", NULL);
cd37fb
 	fd = open_and_copy_file(e->filename, backup_name, FALSE, error);
cd37fb
 	g_free (backup_name);
cd37fb
-	close(fd);
cd37fb
 	if (fd == -1)
cd37fb
 		goto err_fscreate;
cd37fb
+	close(fd);
cd37fb
 
cd37fb
 	e->new_filename = g_strconcat(e->filename, "+", NULL);
cd37fb
 	e->new_fd = open_and_copy_file(e->filename, e->new_filename, TRUE,
cd37fb
-- 
cd37fb
2.14.4
cd37fb