delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2016/11/11/00:01:42

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:subject:to:references:from:message-id:date
:mime-version:in-reply-to:content-type
:content-transfer-encoding; q=dns; s=default; b=w2Agg0NITlVm0mMj
cOX3pnJNNNkTg8n/Hz8zWY1Mf/hbRqkl1Fx3YQ0vjCcM8/HKOreDEte29K8n2vXV
TN/CiyTDwe6t03tky1J+zva1f/ufxbPM2asJcC9DKUUZRCmknKGGySzeehFAs7yu
blBw6ITTlQNJCoJJz+6VMaV8BGE=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:subject:to:references:from:message-id:date
:mime-version:in-reply-to:content-type
:content-transfer-encoding; s=default; bh=to/9VUOiF5d7veZKReOg4f
/cCAA=; b=aE9pfrZyqWHLi7MIAkY9gnbcQx74RhUcuPj45tPoS42veqnpsjpGPC
J2cbaWNiY+MuQBffZQ7+plouprMJbRjkvp+3FQaA7P6m4i63gJORyv8yqBhHpcRK
095NGxLypdFDgPbeCzPTp9GrSgq6GScO5NFL/ZHSgYXu5zjELx1K4=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1500
X-HELO: mail-it0-f43.google.com
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=RJTE1CBOw6oqt2+QxeYiaw3Cb4yChonTa0nhGWt1ijc=; b=U46mKpUM7S/IMZ+9UNSwK4FFYjNWWZ6YHKRA8VTjDTZddrfsTdXgmfxsXvPA/axEZu nYuw/qUm052aKaY98h1j06ywgQR1GiVaOEGW18o68oquw4Qx8cYurwYpw5K2Ydn/EWyu 5iGaeQ1AZGNEuhGep2a7a2Wqu8TOQt18dExtk+i29q8CAOnSrr4EcJ6lUFs0LoWJ36iL ZPSzCiAnNjHRI1zfZSLj0Qf0v8u8vS3qxmKWfWA6mVAe/8ipDN1fb0tQDQNmWEwKMvbR QK0g065AZXxKPOXSy9hsgkzTwHK67m8LnrqmZ3cZw32GQkRt6dCIf008dBaq2dhIaatW 0XAg==
X-Gm-Message-State: ABUngvedIZJ98Term83OQaJdnzxyejzeJRgQxXuAPBEK4B11WIYZ6mBv8UQzIW2UFfHAoA==
X-Received: by 10.36.69.155 with SMTP id c27mr20061691itd.1.1478840481129; Thu, 10 Nov 2016 21:01:21 -0800 (PST)
Subject: Re: issetugid - not declared when _XOPEN_SOURCE is also defined
To: cygwin AT cygwin DOT com
References: <d61199c7-85d2-039d-58cb-29fb8d6ff369 AT gmail DOT com> <9bb90c12-b50b-faf9-b309-f916dd84bebe AT gmail DOT com> <20161110091010 DOT GB6075 AT calimero DOT vinschen DOT de>
From: cyg Simple <cygsimple AT gmail DOT com>
Message-ID: <db1df1ed-6bb7-5a18-97a3-f61397cc2481@gmail.com>
Date: Fri, 11 Nov 2016 00:01:12 -0500
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0
MIME-Version: 1.0
In-Reply-To: <20161110091010.GB6075@calimero.vinschen.de>
X-IsSubscribed: yes

On 11/10/2016 4:10 AM, Corinna Vinschen wrote:
> On Nov  9 14:41, cyg Simple wrote:
>> On 11/9/2016 1:13 PM, cyg Simple wrote:
>>> The following program demonstrates the issue.  Should issetugid be
>>> declared with this scenario?
>>>
>>> /*****************************************************/
>>> #define _XOPEN_SOURCE 1  /* Causes declare warning */
>>> #define __BSD_VISIBLE 1
>>> #include <unistd.h>
>>>
>>> int main(int argc, char ** argv) {
>>> 	int result;
>>> 	result = issetugid();
>>> }
>>> /****************************************************/
>>>
>>
>> Because when _XOPEN_SOURCE is 1 _DEFAULT_SOURCE doesn't get set which
>> then #undef __BSD_VISIBLE and and sets it to 0.  See
>> /usr/include/sys/features.h.
>>
>> If I #define _DEFAULT_SOURCE 1 before the #include then the above code
>> works.  However, should it?
> 
> Yes.  You have a bug in your code.  Never (and I mean *never*) use the
> __foo_VISIBLE macros in your code.  Please read the long comment
> preceeding the visibility macro handling in /usr/include/sys/features.h.
> You want to use either _DEFAULT_SOURCE or _BSD_SOURCE (deprecated but
> probably available for another 100 years).
> 
> Also, note the description of the __foo_VISIBLE macros later in the file.
> It introduces the macros as "private" macros.

Yea, I figured that out.  I used __BSD_VISIBLE after looking at the
header for the function.  Thanks for your time; sorry for wasting it.

-- 
cyg Simple

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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