garbage is allowed in the f[re]open mode string
This commit is contained in:
parent
6ab26e5cdc
commit
470bb82342
|
@ -73,14 +73,16 @@ fopen(const char *name, const char *mode)
|
|||
while (*mode) {
|
||||
switch(*mode++) {
|
||||
case 'b':
|
||||
break;
|
||||
continue;
|
||||
case '+':
|
||||
rwmode = O_RDWR;
|
||||
flags |= _IOREAD | _IOWRITE;
|
||||
break;
|
||||
continue;
|
||||
/* The sequence may be followed by additional characters */
|
||||
default:
|
||||
return (FILE *)NULL;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/* Perform a creat() when the file should be truncated or when
|
||||
|
|
|
@ -56,14 +56,16 @@ freopen(const char *name, const char *mode, FILE *stream)
|
|||
while (*mode) {
|
||||
switch(*mode++) {
|
||||
case 'b':
|
||||
break;
|
||||
continue;
|
||||
case '+':
|
||||
rwmode = O_RDWR;
|
||||
flags |= _IOREAD | _IOWRITE;
|
||||
break;
|
||||
continue;
|
||||
/* The sequence may be followed by aditional characters */
|
||||
default:
|
||||
return (FILE *)NULL;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if ((rwflags & O_TRUNC)
|
||||
|
|
Loading…
Reference in a new issue