From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2602 invoked by alias); 13 Jun 2018 15:08:34 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 42997 Received: (qmail 15029 invoked by uid 1010); 13 Jun 2018 15:08:34 -0000 X-Qmail-Scanner-Diagnostics: from mail-lf0-f66.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.215.66):SA:0(-1.9/5.0):. Processed in 1.386597 secs); 13 Jun 2018 15:08:34 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_PASS,T_DKIMWL_WL_MED,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: schaefer@brasslantern.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=APWVwad9ZvzwecjAgdyAhNPyQj5vxg6IFB16QRTZvsg=; b=ZTKa6/4qPI0bGPQ6MBnhnWEvCI0zm/WVpbpYW8Z1jQv9Msbls1XyFhvWldV5H1d6XT ZZrkS0LmY5y4FDLDFnsXI0DPiStR0ofC3eNf8GtBElS4BiOKCZGKNi24+jf8zI1Nq/cB R/ebwKJE9Xuig7dbURuqAv9WlDHUoNbcvPJafgcPErWV2Gxcxl5BHABiE0Eq99zKS17h B6zx7w2mVEuLvVYCOz+7Gn6pWzH9GWeZ4O88k0lBxjydF6zTfUbVGQvcXAkHmnvI3FCn dD7x/sVaEpRMWWEpcIfQeM3kgia/h9Jy+Tj9vgWIYjL3AXlfD+F6rCEBDQ9WEVkcKmla an4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=APWVwad9ZvzwecjAgdyAhNPyQj5vxg6IFB16QRTZvsg=; b=b42GDSeWqPVwUUVinAUlQ8ANp84hzbQ+nZ9JRRcdgsWkB/FtmsEbONLOH3Zyt8SNwI REmLSWbYOIV8G0cdgAX0UlrLdCJxz13zRE2gcSLm97VX26wgNCPHIC2Y5hHja3ep1syB GLNU4O7AOnpAW6qg5Of6iGHoXc9sBAwJaXk6RnlwzLstYi7YKsGhIAq3jwwlKpKptECR CKLmDSKk85odYTNRYQ8XmbNeEdUm6+7ODUNZj0xAYILt2J4CAjj2oMdB29008Cif8YE4 3hqDdyfTYevGbB+8Ut1Hg94iHD7+ipIFQ32cIw2sppea5RwLIo8l2xCbtmF1WEqAYREV 1+Qw== X-Gm-Message-State: APt69E2R5OVdvKTFVbS919FOlMBYbh1CbVVrXpsQtFOaBx2k8ANxnYAU ZWDMpdVp1GA3mMfoS+zfCGlqlf5E3BqjtB/wWRBn+Q== X-Google-Smtp-Source: ADUXVKLUDYnjPPWaAW3RzoqfzBfM3PtF5ZYJsQQxwrhBhRYOcjVd2/peBy9SPcYANFQPr3CC6cMkVLFef4Vq1RuyvDs= X-Received: by 2002:a2e:5818:: with SMTP id m24-v6mr3547081ljb.84.1528902507986; Wed, 13 Jun 2018 08:08:27 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <20180613131021eucas1p263704fa9832375e6a49cf7f2077606dc~3ukj6hhqT1702017020eucas1p2W@eucas1p2.samsung.com> References: <20180613131021eucas1p263704fa9832375e6a49cf7f2077606dc~3ukj6hhqT1702017020eucas1p2W@eucas1p2.samsung.com> From: Bart Schaefer Date: Wed, 13 Jun 2018 08:08:27 -0700 Message-ID: Subject: Re: [PATCH] Silence compilation warnings about setuid, setgid To: Peter Stephenson Cc: Zsh hackers list Content-Type: text/plain; charset="UTF-8" On Wed, Jun 13, 2018 at 6:10 AM, Peter Stephenson wrote: > On Wed, 13 Jun 2018 04:49:39 -0700 > Eitan Adler wrote: >> >> setgid must be called before setuid. If setuid is called first, on >> some platforms, it no longer has privs to call setgid aymore. > > Presumably that's a trivial swap? I don't know if we need both > setgid()s before both setuid()s, because I don't know why they're > repeated --- but if the second case is simply to test for an error that's > not a big deal since if it worked properly there won't be one. IIRC there are some cases in which setgid/setuid fail silently, i.e., without changing anything but without setting errno. The second calls are to double-check that the first one was not rogue in that way. This may have been isolated to a 1990s-era OS that is no longer at issue. Either way there's no particular reason to save and report errno from the first call.