diff mbox

[libdrm,4/4] Consistently check the fd value

Message ID 1436883005-6163-4-git-send-email-emil.l.velikov@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Emil Velikov July 14, 2015, 2:10 p.m. UTC
Follow the approach used through the rest of the project.

Cc: Thierry Reding <thierry.reding@gmail.com>
Suggested-by: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
---
 intel/test_decode.c  | 2 +-
 tests/name_from_fd.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Thierry Reding July 15, 2015, 11:47 a.m. UTC | #1
On Tue, Jul 14, 2015 at 03:10:05PM +0100, Emil Velikov wrote:
> Follow the approach used through the rest of the project.
> 
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Suggested-by: Thierry Reding <thierry.reding@gmail.com>
> Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
> ---
>  intel/test_decode.c  | 2 +-
>  tests/name_from_fd.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Thierry Reding <treding@nvidia.com>

> diff --git a/intel/test_decode.c b/intel/test_decode.c
> index bef86bb..b4eddcd 100644
> --- a/intel/test_decode.c
> +++ b/intel/test_decode.c
> @@ -56,7 +56,7 @@ read_file(const char *filename, void **ptr, size_t *size)
>  	struct stat st;
>  
>  	fd = open(filename, O_RDONLY);
> -	if (fd == -1)
> +	if (fd < 0)
>  		errx(1, "couldn't open `%s'", filename);
>  
>  	ret = fstat(fd, &st);
> diff --git a/tests/name_from_fd.c b/tests/name_from_fd.c
> index 24af6e6..5264681 100644
> --- a/tests/name_from_fd.c
> +++ b/tests/name_from_fd.c
> @@ -45,7 +45,7 @@ int main(int argc, char **argv)
>  	char *v;
>  
>  	fd = open("/dev/dri/card0", O_RDWR);
> -	if (fd == -1)
> +	if (fd < 0)
>  		return 0;
>  
>  	v = drmGetDeviceNameFromFd(fd);
> -- 
> 2.4.5
>
diff mbox

Patch

diff --git a/intel/test_decode.c b/intel/test_decode.c
index bef86bb..b4eddcd 100644
--- a/intel/test_decode.c
+++ b/intel/test_decode.c
@@ -56,7 +56,7 @@  read_file(const char *filename, void **ptr, size_t *size)
 	struct stat st;
 
 	fd = open(filename, O_RDONLY);
-	if (fd == -1)
+	if (fd < 0)
 		errx(1, "couldn't open `%s'", filename);
 
 	ret = fstat(fd, &st);
diff --git a/tests/name_from_fd.c b/tests/name_from_fd.c
index 24af6e6..5264681 100644
--- a/tests/name_from_fd.c
+++ b/tests/name_from_fd.c
@@ -45,7 +45,7 @@  int main(int argc, char **argv)
 	char *v;
 
 	fd = open("/dev/dri/card0", O_RDWR);
-	if (fd == -1)
+	if (fd < 0)
 		return 0;
 
 	v = drmGetDeviceNameFromFd(fd);