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))
|