Consistently check the fd value
Follow the approach used through the rest of the project. Suggested-by: Thierry Reding <thierry.reding@gmail.com> Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Thierry Reding <treding@nvidia.com>main
parent
c1cd3d9388
commit
c08655271a
|
@ -56,7 +56,7 @@ read_file(const char *filename, void **ptr, size_t *size)
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
fd = open(filename, O_RDONLY);
|
fd = open(filename, O_RDONLY);
|
||||||
if (fd == -1)
|
if (fd < 0)
|
||||||
errx(1, "couldn't open `%s'", filename);
|
errx(1, "couldn't open `%s'", filename);
|
||||||
|
|
||||||
ret = fstat(fd, &st);
|
ret = fstat(fd, &st);
|
||||||
|
|
|
@ -45,7 +45,7 @@ int main(int argc, char **argv)
|
||||||
char *v;
|
char *v;
|
||||||
|
|
||||||
fd = open("/dev/dri/card0", O_RDWR);
|
fd = open("/dev/dri/card0", O_RDWR);
|
||||||
if (fd == -1)
|
if (fd < 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
v = drmGetDeviceNameFromFd(fd);
|
v = drmGetDeviceNameFromFd(fd);
|
||||||
|
|
Loading…
Reference in New Issue