All of lore.kernel.org
 help / color / mirror / Atom feed
From: Emil Velikov <emil.l.velikov@gmail.com>
To: dri-devel@lists.freedesktop.org
Cc: emil.l.velikov@gmail.com
Subject: [PATCH libdrm 4/4] Consistently check the fd value
Date: Tue, 14 Jul 2015 15:10:05 +0100	[thread overview]
Message-ID: <1436883005-6163-4-git-send-email-emil.l.velikov@gmail.com> (raw)
In-Reply-To: <1436883005-6163-1-git-send-email-emil.l.velikov@gmail.com>

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(-)

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

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2015-07-14 14:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-14 14:10 [PATCH libdrm 1/4] freedreno: zero is a valid fd number, treat it as such Emil Velikov
2015-07-14 14:10 ` [PATCH libdrm 2/4] omap: " Emil Velikov
2015-07-15 11:30   ` Thierry Reding
2015-07-14 14:10 ` [PATCH libdrm 3/4] xf86drm: fix incorrect fd comparison in drmOpenOnce{, WithType} Emil Velikov
2015-07-15 11:47   ` [PATCH libdrm 3/4] xf86drm: fix incorrect fd comparison in drmOpenOnce{,WithType} Thierry Reding
2015-07-15 12:37     ` [PATCH libdrm 3/4] xf86drm: fix incorrect fd comparison in drmOpenOnce{, WithType} Emil Velikov
2015-07-15 12:47       ` [PATCH libdrm 3/4] xf86drm: fix incorrect fd comparison in drmOpenOnce{,WithType} Thierry Reding
2015-07-16 15:53         ` [PATCH libdrm 3/4] xf86drm: fix incorrect fd comparison in drmOpenOnce{, WithType} Emil Velikov
2015-07-14 14:10 ` Emil Velikov [this message]
2015-07-15 11:47   ` [PATCH libdrm 4/4] Consistently check the fd value Thierry Reding

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1436883005-6163-4-git-send-email-emil.l.velikov@gmail.com \
    --to=emil.l.velikov@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.