From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 88CAF3858289 for ; Thu, 25 May 2023 16:11:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 88CAF3858289 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685031070; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HkalIl/2B9npJaoZCjoPE7GT9mbo/cdQbhmR1F1GTyQ=; b=C1avBVhEAOJq+uJ2X7OVlVooBEONvHjHH5YwNOjo+R46hwqAQm3a8CkVbcHssC2IKq3GUE N7YDwqudw7pnY/QzFq2gYcyORpAK++cwZSvgozElYQ3gDmsCaGYzYe8oQobE0mdiyzwzPP bHUxJiJEwaxBF/dzVrAuveA0J++rprM= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-517--zIw8_MHMp-f8Njq06Kv8w-1; Thu, 25 May 2023 12:11:08 -0400 X-MC-Unique: -zIw8_MHMp-f8Njq06Kv8w-1 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-96f4f1bb838so81282766b.3 for ; Thu, 25 May 2023 09:11:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685031067; x=1687623067; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HkalIl/2B9npJaoZCjoPE7GT9mbo/cdQbhmR1F1GTyQ=; b=a428EmJvA06HPP8ImVFZlA8JVy8zfyKWYlWdhfy7Z/ESM0hJfaTjaAj2gYnJy01iws MmUOnWwl8p6LtGojzpJ/DexoktOajgEs4GDa34MFhCOcdNcrRekLZ3ShqQ7Iof7V3p1v racGxOEIL8XVDzYDLenP0rE6kQtIHjyppjQx9mI1PO4IT0wSdgTFDLiZFvKo4uEbhKCH 8acqJ8LS1yrVoK8/zJIb0MnRZJRdsE9rBjsDs3S6+DXu7RBtzhz11iSaE9SH5y0Lbcwf xjMmrvwo6VGsqw22pXWi2quV2OvME0ceDyApRjnYRuvDZSHSjIjpaXj8i7T/h34w/W+7 Dz/Q== X-Gm-Message-State: AC+VfDxyXI2sEGfEQ3N+OhOHWghIiBp26mHPnJ3sSwnbYOHByu6BV36x ExmmgW9xGkIsv/oItrsml6Rhs2AGFudaXtQNNeTq9PMJW4OS+Dp+YTTcMZeJrB6sswCn9WohjSH 6gkmKxcYtl9aheQ+GZJDt5DASg2J5/lnUZXVGmgxW/Hyr X-Received: by 2002:a17:906:fe45:b0:96f:cf25:4bb8 with SMTP id wz5-20020a170906fe4500b0096fcf254bb8mr2043462ejb.32.1685031067045; Thu, 25 May 2023 09:11:07 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7dpe1wyqtrevBXMXcPJZu5K9gpylDcu5E3fDecnIBceg35uRddX/Y1yCAUZoBi6sKIkUDM4uNJC9Yi4YhIUfA= X-Received: by 2002:a17:906:fe45:b0:96f:cf25:4bb8 with SMTP id wz5-20020a170906fe4500b0096fcf254bb8mr2043422ejb.32.1685031066563; Thu, 25 May 2023 09:11:06 -0700 (PDT) MIME-Version: 1.0 References: <20230428122142.928135-1-fberat@redhat.com> <20230428122142.928135-15-fberat@redhat.com> <292a63d2-b54a-d0c0-84e9-5a197af94305@gotplt.org> In-Reply-To: <292a63d2-b54a-d0c0-84e9-5a197af94305@gotplt.org> From: Frederic Berat Date: Thu, 25 May 2023 18:10:55 +0200 Message-ID: Subject: Re: [PATCH v4 14/15] tests: Replace various function calls with their x variant To: Siddhesh Poyarekar Cc: libc-alpha@sourceware.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: It looks like I didn't actually send the changes mentioned in the title, I may have messed with my patches on this one. On Thu, May 25, 2023 at 3:29=E2=80=AFAM Siddhesh Poyarekar wrote: > > > > On 2023-04-28 08:21, Fr=C3=A9d=C3=A9ric B=C3=A9rat wrote: > > With fortification enabled, few function calls return result need to be > > checked, has they get the __wur macro enabled. > > --- > > misc/tst-error1.c | 2 +- > > nss/tst-reload2.c | 6 +++++- > > posix/tst-chmod.c | 9 +++++++-- > > posix/wordexp-test.c | 6 +++++- > > stdlib/test-canon.c | 7 ++++++- > > 5 files changed, 24 insertions(+), 6 deletions(-) > > > > diff --git a/misc/tst-error1.c b/misc/tst-error1.c > > index 9c4a62fbd0..65e3fd0c0e 100644 > > --- a/misc/tst-error1.c > > +++ b/misc/tst-error1.c > > @@ -9,7 +9,7 @@ static int > > do_test (int argc, char *argv[]) > > { > > mtrace (); > > - (void) freopen (argc =3D=3D 1 ? "/dev/stdout" : argv[1], "a", stderr= ); > > + if (freopen (argc =3D=3D 1 ? "/dev/stdout" : argv[1], "a", stderr)) = {} > > There is an xfreopen in support/ > > > /* Orient the stream. */ > > fwprintf (stderr, L"hello world\n"); > > char buf[20000]; > > diff --git a/nss/tst-reload2.c b/nss/tst-reload2.c > > index ba9b5b7687..b25e5e3528 100644 > > --- a/nss/tst-reload2.c > > +++ b/nss/tst-reload2.c > > @@ -121,7 +121,11 @@ do_test (void) > > /* Change the root dir. */ > > > > TEST_VERIFY (chroot ("/subdir") =3D=3D 0); > > - chdir ("/"); > > + if (chdir ("/") < 0) > > There is an xchdir in support/ > > > + { > > + printf("Failed to change directory: %m"); > > + return 1; > > + } > > > > /* Check we're NOT using the "inner" nsswitch.conf. */ > > > > diff --git a/posix/tst-chmod.c b/posix/tst-chmod.c > > index b98a05a265..bec2d2b8eb 100644 > > --- a/posix/tst-chmod.c > > +++ b/posix/tst-chmod.c > > @@ -229,7 +229,12 @@ do_test (int argc, char *argv[]) > > close (fd); > > > > snprintf (buf, buflen, "%s/..", testdir); > > - chdir (buf); > > + if (chdir (buf)) > > + { > > + printf ("cannot change directory: %m\n"); > > + result =3D 1; > > + goto fail; > > + } > > /* We are now in the directory above the one we create the test > > directory in. */ > > > > @@ -349,7 +354,7 @@ do_test (int argc, char *argv[]) > > } > > > > fail: > > - chdir (startdir); > > + if (chdir (startdir)) {} > > > > /* Remove all the files. */ > > chmod (testdir, 0700); > > diff --git a/posix/wordexp-test.c b/posix/wordexp-test.c > > index bae27d6cee..87d537c931 100644 > > --- a/posix/wordexp-test.c > > +++ b/posix/wordexp-test.c > > @@ -332,7 +332,11 @@ do_test (int argc, char *argv[]) > > if (cwd =3D=3D NULL) > > cwd =3D ".."; > > > > - chdir (cwd); > > + if (chdir (cwd) < 0) > > + { > > + printf ("failed to change dir: %m"); > > + return 1; > > + } > > rmdir (tmpdir); > > > > return 0; > > diff --git a/stdlib/test-canon.c b/stdlib/test-canon.c > > index 4edee73dd8..5a2e7e1e6e 100644 > > --- a/stdlib/test-canon.c > > +++ b/stdlib/test-canon.c > > @@ -154,7 +154,12 @@ do_test (int argc, char ** argv) > > } > > > > for (i =3D 0; i < (int) (sizeof (symlinks) / sizeof (symlinks[0]));= ++i) > > - symlink (symlinks[i].value, symlinks[i].name); > > + if (symlink (symlinks[i].value, symlinks[i].name)) > > There is an xsymlink in support/ > > > + { > > + printf ("%s: Unable to create symlink for %s -> %s\n", > > + argv[0], symlinks[i].name, symlinks[i].value); > > + ++errors; > > + } > > > > int has_dir =3D mkdir ("doesExist", 0777) =3D=3D 0; > > >