mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 17:48:10 +02:00
util/os_file: avoid shadowing read() with a local variable
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com> Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
parent
7e35f20d44
commit
341ba406fd
1 changed files with 5 additions and 5 deletions
|
|
@ -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';
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue