From: Tvrtko Ursulin <[email protected]>

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

Signed-off-by: Tvrtko Ursulin <[email protected]>
---
 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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to