util/os_file: avoid shadowing read() with a local variable
authorEric Engestrom <eric.engestrom@intel.com>
Thu, 16 May 2019 14:02:45 +0000 (15:02 +0100)
committerEric Engestrom <eric@engestrom.ch>
Sun, 9 Jun 2019 13:14:13 +0000 (13:14 +0000)
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/util/os_file.c

index da17d12b50e5d67e5ea89a59da3397fa131f7214..400a2a12c4dd79de36fdf43632c2110115f924de 100644 (file)
@@ -70,9 +70,9 @@ os_read_file(const char *filename)
       return NULL;
    }
 
-   ssize_t read;
+   ssize_t actually_read;
    size_t offset = 0, remaining = len - 1;
-   while ((read = readN(fd, buf + offset, remaining)) == remaining) {
+   while ((actually_read = readN(fd, buf + offset, remaining)) == remaining) {
       char *newbuf = realloc(buf, 2 * len);
       if (!newbuf) {
          free(buf);
@@ -83,14 +83,14 @@ os_read_file(const char *filename)
 
       buf = newbuf;
       len *= 2;
-      offset += read;
+      offset += actually_read;
       remaining = len - offset - 1;
    }
 
    close(fd);
 
-   if (read > 0)
-      offset += read;
+   if (actually_read > 0)
+      offset += actually_read;
 
    buf[offset] = '\0';