From f05104af76e26f0757df1500540e767dd889ae71 Mon Sep 17 00:00:00 2001 From: Marian Csontos Date: Wed, 19 Dec 2018 16:29:31 +0100 Subject: [PATCH] cov: Close a FD on error --- tools/pvscan.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/pvscan.c b/tools/pvscan.c index 2a884df1d..6841f201b 100644 --- a/tools/pvscan.c +++ b/tools/pvscan.c @@ -290,7 +290,8 @@ static int _online_pvid_file_create(struct device *dev) rv = write(fd, buf, len); if (rv < 0) { log_error("Failed to write fd %d buf %s dev %s to %s: %d", - fd, buf, dev_name(dev), path, errno); + fd, buf, dev_name(dev), path, errno); + close(fd); return 0; } len -= rv; -- 2.43.5