summaryrefslogtreecommitdiffstats
path: root/src/util/os_file.c
Commit message (Collapse)AuthorAgeFilesLines
* util/os_file: suppress sign comparison warningEric Engestrom2019-06-091-1/+1
| | | | | Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* util/os_file: fix error being sign-cast back and forthEric Engestrom2019-06-091-1/+1
| | | | | Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* util/os_file: avoid shadowing read() with a local variableEric Engestrom2019-06-091-5/+5
| | | | | Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* util/os_file: actually return the error read() gave usEric Engestrom2019-06-091-1/+3
| | | | | | Fixes: 316964709e21286c2af5 "util: add os_read_file() helper" Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* util/os_file: always use the 'grow' mechanismEric Engestrom2019-05-161-42/+20
| | | | | | | | | | | | | Use fstat() only to pre-allocate a big enough buffer. This fixes a race where if the file grows between fstat() and read() we would be missing the end of the file, and if the file slims down read() would just fail. Fixes: 316964709e21286c2af5 "util: add os_read_file() helper" Reported-by: Jason Ekstrand <[email protected]> Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* util: move #include out of #if linuxEric Engestrom2019-05-011-1/+1
| | | | | | | | | This #include is needed for `NULL`, which is used on all OSes, not just Linux. Reported-by: Juan A. Suarez Romero <[email protected]> Fixes: 316964709e21286c2af5 "util: add os_read_file() helper" Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Juan A. Suarez <[email protected]>
* util: add os_read_file() helperEric Engestrom2019-04-301-0/+129
readN() taken from igt. os_read_file() inspired by igt_sysfs_get() Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>