From: Tvrtko Ursulin <tursulin@ursulin.net>
To: igt-dev@lists.freedesktop.org
Cc: Intel-gfx@lists.freedesktop.org,
Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Subject: [igt-dev] [PATH i-g-t] igt_sysfs: Avoid double closing the fd in igt_sysfs_scanf
Date: Thu, 13 Sep 2018 16:06:13 +0100 [thread overview]
Message-ID: <20180913150613.16265-1-tvrtko.ursulin@linux.intel.com> (raw)
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
fdopen takes ownership of the fd so only one flavour of closing it is
needed.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
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
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next reply other threads:[~2018-09-13 15:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-13 15:06 Tvrtko Ursulin [this message]
2018-09-13 15:20 ` [igt-dev] [PATH i-g-t] igt_sysfs: Avoid double closing the fd in igt_sysfs_scanf Chris Wilson
2018-09-13 16:14 ` [igt-dev] ✗ Fi.CI.BAT: failure for " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180913150613.16265-1-tvrtko.ursulin@linux.intel.com \
--to=tursulin@ursulin.net \
--cc=Intel-gfx@lists.freedesktop.org \
--cc=igt-dev@lists.freedesktop.org \
--cc=tvrtko.ursulin@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox