From a056f7c4cd23012932ea9013967d87177219797a Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sat, 25 Mar 2017 00:11:26 +0000 Subject: lib/sysfs: stop before calling write with zero bytes Signed-off-by: Chris Wilson --- lib/igt_sysfs.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib') 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); } -- cgit v1.2.3