summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2017-12-14 20:59:38 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2017-12-15 11:22:30 +0000
commit9dd7e9b6f4c96cc1fd1c930452c7f54c12892b9d (patch)
treefc034a9d167c059fadafe16869e929eb4e6f701c
parentd35ce13878e53c08fad2d43fec411eb041d24bb5 (diff)
lib/sysfs: Handle EINTR from vfprintf()
Some write operations into sysfs may be slow and potentially interrupted by a signal. So handle EINTR by repeating the vfprintf(). A partial is reported back to the caller, as is any other error. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com
-rw-r--r--lib/igt_sysfs.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/igt_sysfs.c b/lib/igt_sysfs.c
index e7c67dae..030d1c6a 100644
--- a/lib/igt_sysfs.c
+++ b/lib/igt_sysfs.c
@@ -399,7 +399,9 @@ int igt_sysfs_vprintf(int dir, const char *attr, const char *fmt, va_list ap)
file = fdopen(fd, "w");
if (file) {
- ret = vfprintf(file, fmt, ap);
+ do {
+ ret = vfprintf(file, fmt, ap);
+ } while (ret == -1 && errno == EINTR);
fclose(file);
}
close(fd);