[PATCH 22/42] state: storage: direct: do not close file that is not opened

Sascha Hauer s.hauer at pengutronix.de
Fri Mar 31 00:03:26 PDT 2017


When open failed to not try to close the invalid fd afterwards.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 common/state/backend_bucket_direct.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/common/state/backend_bucket_direct.c b/common/state/backend_bucket_direct.c
index b72e8adb96..4465ed0e41 100644
--- a/common/state/backend_bucket_direct.c
+++ b/common/state/backend_bucket_direct.c
@@ -156,7 +156,6 @@ int state_backend_bucket_direct_create(struct device_d *dev, const char *path,
 	fd = open(path, O_RDWR);
 	if (fd < 0) {
 		dev_err(dev, "Failed to open file '%s', %d\n", path, -errno);
-		close(fd);
 		return -errno;
 	}
 
-- 
2.11.0




More information about the barebox mailing list