Loading...
--- Libc/Libc-763.13/stdio/FreeBSD/flags.c
+++ Libc/Libc-1669.0.4/stdio/FreeBSD/flags.c
@@ -49,9 +49,7 @@
* Return 0 on error.
*/
int
-__sflags(mode, optr)
- const char *mode;
- int *optr;
+__sflags(const char *mode, int *optr)
{
int ret, m, o;
@@ -81,10 +79,17 @@
}
/* [rwa]\+ or [rwa]b\+ means read and write */
- if (*mode == '+' || (*mode == 'b' && mode[1] == '+')) {
+ if (*mode == 'b')
+ mode++;
+ if (*mode == '+') {
ret = __SRW;
m = O_RDWR;
+ mode++;
+ if (*mode == 'b')
+ mode++;
}
+ if (*mode == 'x')
+ o |= O_EXCL;
*optr = m | o;
return (ret);
}