delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2016/11/10/04:10:51

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:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; q=dns; s=
default; b=eQXuCNtKvyVC3CsNRzP+IXYurdUf1oQqmf+0HvRA261jp5v6VTdS1
/ajU2oL3heVFJtmaiMrVXYJPLHXrJJCaRNPaB+4vaeARYTdirx2+q7kj9ZOSxLgc
dKFi8GZi+wF+thsIIiVvcX9EnDD3mtbdmZrD74ydRpvDF6D4D8Nq7M=
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:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; s=default;
bh=zxBf6A/lLJbr+mksu9HfkAmUHR4=; b=s3Q8pohdU67WeERkpT+l9qUXCfn3
cVPo6sBUc/Ph8e3GIHG3a5zTc/gaoqVRLQodrn7yr7LOl5jEbafoKsKq5F0aKD1u
JWtn4EvFsQAkL9jFAzIka2jHaNcMZbEtaIOFJqhOtq8WBQUbOEgqBNmQcYi/TiXT
UdUxdemYBiQZIjA=
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=-101.5 required=5.0 tests=AWL,BAYES_00,GOOD_FROM_CORINNA_CYGWIN,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=H*MI:sk:9bb90c1, H*i:sk:9bb90c1, H*f:sk:9bb90c1, H*R:D*cygwin.com
X-HELO: drew.franken.de
Date: Thu, 10 Nov 2016 10:10:10 +0100
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: issetugid - not declared when _XOPEN_SOURCE is also defined
Message-ID: <20161110091010.GB6075@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-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>
MIME-Version: 1.0
In-Reply-To: <9bb90c12-b50b-faf9-b309-f916dd84bebe@gmail.com>
User-Agent: Mutt/1.7.1 (2016-10-04)

--yEPQxsgoJgBvi8ip
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

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?
> >=20
> > /*****************************************************/
> > #define _XOPEN_SOURCE 1  /* Causes declare warning */
> > #define __BSD_VISIBLE 1
> > #include <unistd.h>
> >=20
> > int main(int argc, char ** argv) {
> > 	int result;
> > 	result =3D issetugid();
> > }
> > /****************************************************/
> >=20
>=20
> 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.
>=20
> 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.


HTH,
Corinna

--=20
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

--yEPQxsgoJgBvi8ip
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJYJDlyAAoJEPU2Bp2uRE+gsAoP/2hpgaqtUVHwUQfc8e+0XtuR
Bv5Gf5q4lmdl/oghzOVP+tmVWdH5Ei/Td7O9duZNoijv9VwHpG0pJgTZl5o7mJo5
kVa+sfkQHL1sknGVxQkMqUtrVTk/Ffyc8mE0bb/1vCcDcwgX7m2HUndnpfHs2K1V
HADtnb0y7GuiG20oiYlnqEgJY/EOGM22RMsH2jeSAkdseGsM6pHFHE/ivfXRMP3E
4Ip13stIAtyABHBYAI+94dLgTTleRSC4ZH2M42rSIehUwllgumyR4ykJGrcuIMQp
OOv74Hh3Tnmzj9iFw9DH5FXhP5hDao4lkA6z7AG8/HawW4hqHc5xTZUsS6/MDx5B
MBooM/viMdifCx5Oj0+J8VdMxbHRxp8YI5LBb+cJFUZxlZXKlkZGX/HlTkO3P+FF
BsvampSQEIuKqDCh0JGd1hou1rkLAfaVgZseE2fiu27tIbuv4aPnGkRkMTAMLFtl
caNZuxpN7FnettpZzyDMHL2kn5mFFHsTs9tCgh0oF6GeT1D6nlQ751Tdq03hgJHY
62wOcolyN+dYTc3nNYOycxzOBmuMOr/4fhhHvr56QvNgcaq8cy4A+jpmFPOUccdg
sFR5dX7GuHPE3wQO7BFDzenOdLbPLNQDIRAhSct3dOQDWyqO1EE74u71h5+MQadQ
3Xt6UGDAaRdcwYs97g0D
=bNxA
-----END PGP SIGNATURE-----

--yEPQxsgoJgBvi8ip--

- Raw text -


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