Mail Archives: djgpp-workers/2002/04/05/05:07:35
Hello.
Eli Zaretskii wrote:
>
> Richard Dawe wrote:
>
[snip]
> > BTW _creatnew seems to ignore the flags that are passed to it. For
> > instance, if you try to create a new file in write-only mode, then
> > _creatnew ignores the write-only flag and opens it read-write.
>
> That sounds like a bug that should be fixed, but could you please
> elaborate? Where does _creatnew ignore the flags? I see the code
> does use the value of flags when it invokes system calls.
src/libc/dos/io/_creat_n.c, lines 31, 32:
r.x.bx =
0x2002 | (flags & 0xfff0); /* r/w, no Int 24h, use caller-defined flags */
The bottom four bits specify the open mode. Here we override what the user
specified with 2, which is read-write.
_creatnew is used in the following sources:
ansi/stdio/tmpfile.c
compat/stdio/mkstemp.c
posix/fcntl/open.c
The calls to _creatnew in ansi/stdio/tmpfile.c and compat/stdio/mkstemp.c
don't specify any flags in the call to open. If we fix the bug in _creatnew,
we should probably specify the flags in those calls to open.
Thanks, bye, Rich =]
--
Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]
- Raw text -