[PATH i-g-t] igt_sysfs: Avoid double closing the fd in igt_sysfs_scanf

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>

fdopen takes ownership of the fd so only one flavour of closing it is
needed.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>
---
 lib/igt_sysfs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/igt_sysfs.c b/lib/igt_sysfs.c
index 9012cc73f6e3..d323b81dd986 100644
--- a/lib/igt_sysfs.c
+++ b/lib/igt_sysfs.c
@@ -379,8 +379,9 @@ int igt_sysfs_scanf(int dir, const char *attr, const char *fmt, ...)
 		va_end(ap);
 
 		fclose(file);
+	} else {
+		close(fd);
 	}
-	close(fd);
 
 	return ret;
 }
-- 
2.17.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux