Plan 9 from Bell Labs’s /usr/web/sources/contrib/uriel/changes/2006/0413/1

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


usb: avoid closing -1.
 [rsc] --rw-rw-r-- M 779778 sape sys 3073 Apr 13 01:11 sys/src/cmd/usb/lib/device.c
	/n/sourcesdump/2006/0413/plan9/sys/src/cmd/usb/lib/device.c:37,44 - 
	/n/sourcesdump/2006/0414/plan9/sys/src/cmd/usb/lib/device.c:37,45
	  		sprint(name, "/dev/usb%d/new", ctlrno);
	  		if((d->ctl = open(name, ORDWR)) < 0){
	  		Error0:
	- 			close(d->ctl);
	  			werrstr("open %s: %r", name);
	+ 			if(d->ctl >= 0)
	+ 				close(d->ctl);
	  			free(d);
	  			/* return nil; */
	  			sysfatal("%r");
	/n/sourcesdump/2006/0413/plan9/sys/src/cmd/usb/lib/device.c:58,64 - 
	/n/sourcesdump/2006/0414/plan9/sys/src/cmd/usb/lib/device.c:59,66
	  	strcpy(p, "setup");
	  	if((d->setup = open(name, ORDWR)) < 0){
	  	Error1:
	- 		close(d->setup);
	+ 		if(d->setup >= 0)
	+ 			close(d->setup);
	  		goto Error0;
	  	}
	  


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.