Added missing initializer and extra error check.
This commit is contained in:
parent
9062fa2fb5
commit
9c45a6504f
|
@ -18,7 +18,7 @@ fopenRF(name, mode)
|
||||||
int fd;
|
int fd;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
int modebits = -1;
|
int modebits = -1;
|
||||||
int extramodebits;
|
int extramodebits = 0;
|
||||||
char *modep;
|
char *modep;
|
||||||
|
|
||||||
for(modep=mode; *modep; modep++) {
|
for(modep=mode; *modep; modep++) {
|
||||||
|
@ -39,6 +39,10 @@ fopenRF(name, mode)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ( modebits == -1 ) {
|
||||||
|
errno = EINVAL;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
fd = open(name, modebits|extramodebits|O_RSRC);
|
fd = open(name, modebits|extramodebits|O_RSRC);
|
||||||
if ( fd < 0 )
|
if ( fd < 0 )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
Loading…
Reference in New Issue