Add missing check on the result of a VIDIOCCAPTURE ioctl.
authorStefano Sabatini <stefano.sabatini-lala@poste.it>
Fri, 26 Dec 2008 09:12:12 +0000 (09:12 +0000)
committerStefano Sabatini <stefano.sabatini-lala@poste.it>
Fri, 26 Dec 2008 09:12:12 +0000 (09:12 +0000)
Originally committed as revision 16316 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavdevice/v4l.c

index e260dac4512c7e3990640af141b463c39df6e933..6212955352a14c2800aaefa04ce8f16419162a34 100644 (file)
@@ -186,7 +186,10 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
         s->frame_format = pict.palette;
 
         val = 1;
         s->frame_format = pict.palette;
 
         val = 1;
-        ioctl(video_fd, VIDIOCCAPTURE, &val);
+        if (ioctl(video_fd, VIDIOCCAPTURE, &val) < 0) {
+            av_log(s1, AV_LOG_ERROR, "VIDIOCCAPTURE: %s\n", strerror(errno));
+            goto fail;
+        }
 
         s->time_frame = av_gettime() * s->time_base.den / s->time_base.num;
         s->use_mmap = 0;
 
         s->time_frame = av_gettime() * s->time_base.den / s->time_base.num;
         s->use_mmap = 0;