浏览代码

Fix left open file descriptor in v4l2 plugin.

fryshorts 11 年之前
父节点
当前提交
8a51431fdb
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 3 3
      plugins/linux-v4l2/v4l2-input.c

+ 3 - 3
plugins/linux-v4l2/v4l2-input.c

@@ -249,7 +249,7 @@ static void v4l2_device_list(obs_property_t *prop, obs_data_t *settings)
 		if (v4l2_ioctl(fd, VIDIOC_QUERYCAP, &video_cap) == -1) {
 		if (v4l2_ioctl(fd, VIDIOC_QUERYCAP, &video_cap) == -1) {
 			blog(LOG_INFO, "Failed to query capabilities for %s",
 			blog(LOG_INFO, "Failed to query capabilities for %s",
 			     device.array);
 			     device.array);
-			close(fd);
+			v4l2_close(fd);
 			continue;
 			continue;
 		}
 		}
 
 
@@ -260,7 +260,7 @@ static void v4l2_device_list(obs_property_t *prop, obs_data_t *settings)
 		if (!(caps & V4L2_CAP_VIDEO_CAPTURE)) {
 		if (!(caps & V4L2_CAP_VIDEO_CAPTURE)) {
 			blog(LOG_INFO, "%s seems to not support video capture",
 			blog(LOG_INFO, "%s seems to not support video capture",
 			     device.array);
 			     device.array);
-			close(fd);
+			v4l2_close(fd);
 			continue;
 			continue;
 		}
 		}
 
 
@@ -269,7 +269,7 @@ static void v4l2_device_list(obs_property_t *prop, obs_data_t *settings)
 		blog(LOG_INFO, "Found device '%s' at %s", video_cap.card,
 		blog(LOG_INFO, "Found device '%s' at %s", video_cap.card,
 				device.array);
 				device.array);
 
 
-		close(fd);
+		v4l2_close(fd);
 	}
 	}
 
 
 	closedir(dirp);
 	closedir(dirp);