delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2015/05/16/06:14:17

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
X-Recipient: djgpp AT delorie DOT com
X-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20120113;
h=mime-version:in-reply-to:references:date:message-id:subject:from:to
:content-type;
bh=bkw4PvQ4a+BX0VAykZGRX7mOb2V/rio5qNw7dqPDB8I=;
b=n04dxUJB9D5W0QEKANMU0Ou/Qnpq0nEq2IdonQh5fGFZavTWD86sS5Fs465oXipn5T
8VJWe1sgLwmmSEF/6NTasItuTHrYHcuYTgwjIkla4uFuORanN/wt1QV3EWet3MR+WAA5
m0nN/XabjytBTzZiQ3uYAg6K+bh9IC2NCwwhKK5iBZMeRrf+XOjvcR4KD3D3z08DESUn
nE6ffz8N0kCxHlVdlN5jiW2EECrUCBkS7odxyriKaKJe3IPCR8Tm1ksHR3OvXHk5nNq0
Js4oAp823S+MLBfenIsFsLlEzvQHXyTwFlscugEbKDE34CpbAxYvdPoo/eOIv60/UxVc
L/kQ==
MIME-Version: 1.0
X-Received: by 10.50.225.35 with SMTP id rh3mr3316415igc.29.1431771239971;
Sat, 16 May 2015 03:13:59 -0700 (PDT)
In-Reply-To: <83zj54g9fb.fsf@gnu.org>
References: <CAA2C=vARRSgaB0wcN2ya0CAa++KCD5JC9d9GPawQsT6h33QNJg AT mail DOT gmail DOT com>
<83zj54g9fb DOT fsf AT gnu DOT org>
Date: Sat, 16 May 2015 13:13:59 +0300
Message-ID: <CAA2C=vB8ZM8w+Tx5rK=a8eduGZFO-h4fWRbABhNPbNuHFsePbA@mail.gmail.com>
Subject: Re: dlopen.c OPENFLAGS
From: "Ozkan Sezer (sezeroz AT gmail DOT com)" <djgpp AT delorie DOT com>
To: djgpp AT delorie DOT com
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On 5/16/15, Eli Zaretskii (eliz AT gnu DOT org) <djgpp AT delorie DOT com> wrote:
>> Date: Sat, 16 May 2015 12:12:14 +0300
>> From: "Ozkan Sezer (sezeroz AT gmail DOT com)" <djgpp AT delorie DOT com>
>>
>> Is the OPENFLAGS really correct in dlopen.c? I mean, is it not
>> supposed to be like the opposite, like:
>>
>> Index: src/libc/dxe/dlopen.c
>> ===================================================================
>> RCS file: /cvs/djgpp/djgpp/src/libc/dxe/dlopen.c,v
>> retrieving revision 1.4
>> diff -U 6 -r1.4 dlopen.c
>> --- src/libc/dxe/dlopen.c	16 May 2015 05:39:20 -0000	1.4
>> +++ src/libc/dxe/dlopen.c	16 May 2015 09:05:40 -0000
>> @@ -18,21 +18,21 @@
>>  #ifdef __DJGPP__
>>  #include <io.h>
>>  #define ACCESS(f) (_chmod(f, 0) != -1)
>>  #define OPEN _open
>>  #define READ _read
>>  #define CLOSE _close
>> -#define OPENFLAGS O_RDONLY
>> +#define OPENFLAGS O_RDONLY | O_BINARY
>
> No, it should be O_RDONLY, because we call '_open', not 'open', which
> interprets its 2nd argument as read/write access mode, and always
> opens the file in binary mode.  If you add O_BINARY, the argument will
> be 4, which will be interpreted by _open to mean something about
> sharing, which is not what we want.
>
> I do agree that this trick is worth a comment that explains the above.
>

This was good to learn, thanks.

- Raw text -


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