garbage is allowed in the f[re]open mode string

This commit is contained in:
eck 1990-04-24 09:30:15 +00:00
parent 6ab26e5cdc
commit 470bb82342
2 changed files with 10 additions and 6 deletions

View file

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

View file

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