From 17c107d4e4b56d1dbebe1150eec7e34872892108 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Mon, 5 May 2014 12:07:25 +0100 Subject: [PATCH] v4l2: minor fix for closing the fd The fd returned by open() could theoretically be 0 as well. Coverity CID 1211823. --- sys/v4l2/gstv4l2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/v4l2/gstv4l2.c b/sys/v4l2/gstv4l2.c index 9ded33d919..fc36d185cb 100644 --- a/sys/v4l2/gstv4l2.c +++ b/sys/v4l2/gstv4l2.c @@ -102,7 +102,7 @@ gst_v4l2_probe_and_register (GstPlugin * plugin) GstCaps *src_caps, *sink_caps; gchar *basename; - if (video_fd > 0) + if (video_fd >= 0) close (video_fd); video_fd = open (it->device_path, O_RDWR); @@ -158,7 +158,7 @@ gst_v4l2_probe_and_register (GstPlugin * plugin) break; } - if (video_fd > 0) + if (video_fd >= 0) close (video_fd); gst_v4l2_iterator_free (it);