delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2002/04/05/05:07:35

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-workers-bounces using -f
Sender: rich AT phekda DOT freeserve DOT co DOT uk
Message-ID: <3CAD6FE7.1384C841@phekda.freeserve.co.uk>
Date: Fri, 05 Apr 2002 10:35:35 +0100
From: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.19 i586)
X-Accept-Language: de,fr
MIME-Version: 1.0
To: djgpp-workers AT delorie DOT com
Subject: Re: redirection problem with perl
References: <Pine DOT SUN DOT 3 DOT 91 DOT 1020128134413 DOT 26430D-100000 AT is> <3CAB1FDB DOT 68F9CF2F AT phekda DOT freeserve DOT co DOT uk> <7704-Fri05Apr2002112312+0300-eliz AT is DOT elta DOT co DOT il>
Reply-To: djgpp-workers AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019