v4l2: minor fix for closing the fd
authorTim-Philipp Müller <tim@centricular.com>
Mon, 5 May 2014 11:07:25 +0000 (12:07 +0100)
committerTim-Philipp Müller <tim@centricular.com>
Mon, 5 May 2014 11:07:25 +0000 (12:07 +0100)
The fd returned by open() could theoretically be 0 as well.

Coverity CID 1211823.

sys/v4l2/gstv4l2.c

index 9ded33d..fc36d18 100644 (file)
@@ -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);