From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 113928 invoked by alias); 21 Apr 2017 20:04:53 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 113424 invoked by uid 89); 21 Apr 2017 20:04:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-23.5 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-HELO: albireo.enyo.de From: Florian Weimer To: Adhemerval Zanella Cc: Florian Weimer , libc-alpha@sourceware.org, Zack Weinberg Subject: Re: [PATCH v3][BZ 21340] add support for POSIX_SPAWN_SETSID References: <20170405054116.9007-1-quae@daurnimator.com> <75eb12d0-a3f1-2b37-90d5-0a9a3f7f9a99@redhat.com> Date: Fri, 21 Apr 2017 20:04:00 -0000 In-Reply-To: (Adhemerval Zanella's message of "Fri, 21 Apr 2017 12:35:22 -0300") Message-ID: <8760hxv865.fsf@mid.deneb.enyo.de> MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2017-04/txt/msg00484.txt.bz2 * Adhemerval Zanella: > +static int > +do_test_setsid (bool test_setsid) This should return void. > + if (test_setsid) > + { > + if (posix_spawnattr_setflags (&attrp, POSIX_SPAWN_SETSID)) > + FAIL_EXIT1 ("posix_spawnattr_setflags: %m"); > + } You need to set errno before you can use %m. > + res = posix_spawnp (&child, "true", NULL, &attrp, args, environ); > + /* posix_spawnattr_destroy is noop. */ > + posix_spawnattr_destroy (&attrp); > + > + if (res != 0) > + FAIL_EXIT1 ("posix_spawnp: %m"); Likewise. > +static int > +do_test (void) > +{ > + int ret = 0; > + > + ret += do_test_setsid (false); > + ret += do_test_setsid (true); > + > + return 0; > +} ret is effectively unused. > diff --git a/sysdeps/unix/sysv/linux/spawni.c b/sysdeps/unix/sysv/linux/spawni.c > index d7f9e83..3cf77d5 100644 > --- a/sysdeps/unix/sysv/linux/spawni.c > +++ b/sysdeps/unix/sysv/linux/spawni.c > + if ((attr->__flags & POSIX_SPAWN_SETSID) != 0 > + && (ret = __setsid ()) < 0) > + goto fail; I believe the assignment to ret is dead. > + > /* Set the process group ID. */ > if ((attr->__flags & POSIX_SPAWN_SETPGROUP) != 0 > && (ret = __setpgid (0, attr->__pgrp)) != 0) Apparently, this is an existing problem with the code ...