www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2015/09/16/14:07:44

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=Vd9Qhh3Qc9OznquILcXUhK8gyMsLw6Bba4ey9mPpKeA=;
b=o+W7WrkchOt3D2ipFjXwDBaNJsQN7vEj0tBiYt4/6MI/QEL1EkaVDXLVFBCSt1iYEm
F9bb8NLTMsOgcdqjxYUtbRf/YyRLGuH+qanbZ5gQz+X6Ea8GfJa8BeeaMucKgj8h7HaC
WKa7GR07WfckvnQrD8LfZb4Wj+y1j1T7FPOTOvkF7SRCIO79Vd1EGIE/eirwpm4cxvXs
C4zA+wT3hLX5lfTGOb+vaKkrgzFwhG8tLDqIQYhWGaLQvodidjnI3CZ3ZRe7uGwuB3ap
bxnSDzHPuzjUwPC6jO0NmBB8Pfw2HNvNTW/j7cwLv+d341YNve+j/lHZFftaQmHK5dcj
LrTw==
MIME-Version: 1.0
X-Received: by 10.202.88.215 with SMTP id m206mr24139451oib.47.1442426857838;
Wed, 16 Sep 2015 11:07:37 -0700 (PDT)
In-Reply-To: <83d1xi6ye1.fsf@gnu.org>
References: <CAA2C=vCi88BYHh-yRXvtx8az13Y9wymqkjs93UJHx=qaZRPOGQ AT mail DOT gmail DOT com>
<cae6b037-4d08-4255-aa4f-d423a86a0d1c AT googlegroups DOT com>
<83d1xi6ye1 DOT fsf AT gnu DOT org>
Date: Wed, 16 Sep 2015 21:07:37 +0300
Message-ID: <CAA2C=vC4D8sm=3JMbLGAL-cPq7xAMZg32FCU0hezBrhkK9K9kA@mail.gmail.com>
Subject: Re: dlopen.c: make sure filename is not NULL and not empty
From: "Ozkan Sezer (sezeroz AT gmail DOT com) [via djgpp AT delorie 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 9/16/15, Eli Zaretskii (eliz AT gnu DOT org) [via djgpp AT delorie DOT com]
<djgpp AT delorie DOT com> wrote:
>> Date: Wed, 16 Sep 2015 10:14:40 -0700 (PDT)
>> From: "Juan Manuel Guerrero (juan DOT guerrero AT gmx DOT de) [via
>> djgpp AT delorie DOT com]" <djgpp AT delorie DOT com>
>>
>> On Wednesday, September 16, 2015 at 2:39:19 PM UTC+2, Ozkan Sezer
>> (sezeroz AT gmail DOT com) [via djgpp AT delorie DOT com] wrote:
>> > If there are no objections, I want to apply the following
>> > patch to both HEAD and to v2_05_1.  dlopen(NULL,mode) is
>> > supported by glibc but not by djgpp, and such a call left
>> > unchecked will result in Bad Things (TM) to happen.
>> >
>> > Index: dlopen.c
>> > ===================================================================
>> > RCS file: /cvs/djgpp/djgpp/src/libc/dxe/dlopen.c,v
>> > retrieving revision 1.9
>> > diff -u -p -r1.9 dlopen.c
>> > --- dlopen.c	21 Aug 2015 18:10:28 -0000	1.9
>> > +++ dlopen.c	16 Sep 2015 12:02:07 -0000
>> > @@ -119,6 +119,11 @@ void *dlopen(const char *filename, int m
>> >    _dl_unresolved_count = 0;
>> >    errno = 0;
>> >
>> > +  if (!filename || !*filename) {
>> > +    errno = EINVAL;
>> > +    return NULL;
>> > +  }
>> > +
>> >    /* Find the dynamic module along the LD_LIBRARY_PATH */
>> >    if (!ACCESS(filename))
>> >    {
>>
>>
>> Looks ok to me but my man page tells something like this:
>> "If filename is NULL, then the returned handle is for the  main
>> program."
>> What shall this imply for DJGPP?
>
> This feature is for when the function is already statically linked
> into the main program.

Yes, useful in such a case too

>  Can we support this in DJGPP?

Someone will need to implement that, but for 2.06 I think

>  If not, we should return ENOSYS or some such.
>

I used EINVAL, because NULL or "" filename is already an invalid
argument for the current implementation, and ENOSYS would be a
misleading errno.  What do the others think?

--
O.S.

- Raw text -


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