shithub: plan9front

Download patch

ref: e8111e517d0129f33594c4718691e41ced0b2018
parent: fc36bf0711654fa841750f69615112eb4a047e87
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Mon Nov 16 14:56:13 EST 2020

nusb/cam: don't videoclose() when open failed

The fsdestroyfid() is called regardless if the open succeeded
or failed. This causes erroneous videoclose() when opening
the frame or video file while the camera is active.

--- a/sys/src/cmd/nusb/cam/cam.c
+++ b/sys/src/cmd/nusb/cam/cam.c
@@ -284,6 +284,8 @@
 {
 	ReadState *rs;
 
+	if(fid->omode == -1)
+		return;
 	rs = fid->aux;
 	if(rs != nil){
 		free(rs->buf);
--