summaryrefslogtreecommitdiff
path: root/lib/igt_sysfs.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2017-03-25 00:11:26 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2017-03-25 00:20:43 +0000
commita056f7c4cd23012932ea9013967d87177219797a (patch)
treec49ed338bcc8bf580b35c97148be4cbac4e5482e /lib/igt_sysfs.c
parent947f5d8037cafbff3cee0c36219a26f25c5e5204 (diff)
lib/sysfs: stop before calling write with zero bytes
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'lib/igt_sysfs.c')
-rw-r--r--lib/igt_sysfs.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/igt_sysfs.c b/lib/igt_sysfs.c
index dc178b3d..4fd0d47f 100644
--- a/lib/igt_sysfs.c
+++ b/lib/igt_sysfs.c
@@ -63,6 +63,8 @@ static int readN(int fd, char *buf, int len)
return total ?: ret;
total += ret;
+ if (total == len)
+ return total;
} while (1);
}
@@ -78,6 +80,8 @@ static int writeN(int fd, const char *buf, int len)
return total ?: ret;
total += ret;
+ if (total == len)
+ return total;
} while (1);
}