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

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


ctime: avoid fd leak when /env/timezone is missing
 [rsc] --rw-rw-r-- M 628694 glenda sys 4935 Apr 10 11:20 sys/src/libc/9sys/ctime.c
	/n/sourcesdump/2006/0410/plan9/sys/src/libc/9sys/ctime.c:219,226 - 
	/n/sourcesdump/2006/0411/plan9/sys/src/libc/9sys/ctime.c:219,228
	  	i = open("/env/timezone", 0);
	  	if(i < 0)
	  		goto error;
	- 	if(read(i, buf, sizeof(buf)) >= sizeof(buf))
	+ 	if(read(i, buf, sizeof(buf)) >= sizeof(buf)){
	+ 		close(i);
	  		goto error;
	+ 	}
	  	close(i);
	  	p = buf;
	  	if(rd_name(&p, timezone.stname))


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.