From patchwork Sun Mar 26 20:00:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Geissler X-Patchwork-Id: 1761301 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=pUuPDrDC; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Pl6Jd56nxz1yXq for ; Mon, 27 Mar 2023 07:01:05 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 40FFA38515FD for ; Sun, 26 Mar 2023 20:01:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 40FFA38515FD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1679860862; bh=en+2Q6laHdDutxZFJ6R3C9rPxVUOAQP4utUJ8Jy927g=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=pUuPDrDCVAeC4hrYi8cMLR3uvkgvDTYcD2e3+mMAbXerc5CIm7B+VWf5toPg2ZWSV qSRbQ5Zw9rnFp623jnTRVNUsqiDaDR9Y8kQoTVrIGzP476BtpFohjeNSIVUkzbw3yY R4ws2hjc80tpZcAHpSkHdg5QyXHI/4xtPF+3PoVw= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by sourceware.org (Postfix) with ESMTPS id 80CAA3858C00 for ; Sun, 26 Mar 2023 20:00:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 80CAA3858C00 Received: by mail-wr1-x429.google.com with SMTP id j24so6626860wrd.0 for ; Sun, 26 Mar 2023 13:00:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679860843; x=1682452843; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=en+2Q6laHdDutxZFJ6R3C9rPxVUOAQP4utUJ8Jy927g=; b=UxDcPtBuXwM2TSAd2e/zCcYESj8n1m0V77YdLwkOaQs9v3/0H+iV4xS0braEb8thGC rah5wZbQwqeLFBUD25Xgz30qXRQKx9nK+4rDiaeirT1v6UhfVruQ2PxhXEk3Enaxwx7S G40ZzCHbfbl/aq6isO9I6xkEZGJRNZuJ+qg0Tl61W5vVIrAd1dxF1XjjodycJTZdIlLN 6bYnBwzc3bIEXxk8WLoDPvq6ylhv6AtIoNj1UC4krccUBFeffK5CkaWedLYvlRS0m6z1 R6H1hKK9519t/hAocck5MG4SaT8OTNKHm6QscqmaY6KcchQ13FkvUq7fTIPrUlryx2i4 DFnQ== X-Gm-Message-State: AAQBX9ePMp+atJ0YzrpP1o3Wep8k4sK/AO9RywpuIXR2x2HSN0cN4eyR W/4hOWAcUTNp6jo7SeyRjmJUjXU/cMypMQ== X-Google-Smtp-Source: AKy350YW9fpB5s21DwaQLcpkqHLobYHNK2M1EJdmvJ8gVZEnS7cSepNZ6b0U2ntGLR7mzmm3C0JJWw== X-Received: by 2002:adf:e6cc:0:b0:2c7:d80:ffc4 with SMTP id y12-20020adfe6cc000000b002c70d80ffc4mr5636863wrm.7.1679860842890; Sun, 26 Mar 2023 13:00:42 -0700 (PDT) Received: from localhost ([82.66.26.140]) by smtp.gmail.com with ESMTPSA id z6-20020a056000110600b002c557f82e27sm23176361wrw.99.2023.03.26.13.00.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Mar 2023 13:00:42 -0700 (PDT) X-Google-Original-From: Romain Geissler To: libc-alpha@sourceware.org Cc: romain.geissler@amadeus.com Subject: [PATCH 2/3] Fix tst-ldconfig-ld_so_conf-update with custom configure prefix value Date: Sun, 26 Mar 2023 20:00:15 +0000 Message-Id: <20230326200016.219-3-romain.geissler@amadeus.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230326200016.219-1-romain.geissler@amadeus.com> References: <20230326200016.219-1-romain.geissler@amadeus.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Romain Geissler via Libc-alpha From: Romain Geissler Reply-To: Romain Geissler Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" --- elf/tst-ldconfig-ld_so_conf-update.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) Reviewed-by: Adhemerval Zanella diff --git a/elf/tst-ldconfig-ld_so_conf-update.c b/elf/tst-ldconfig-ld_so_conf-update.c index 503afb3211e..2c5c48615d8 100644 --- a/elf/tst-ldconfig-ld_so_conf-update.c +++ b/elf/tst-ldconfig-ld_so_conf-update.c @@ -33,7 +33,6 @@ #define DSO "libldconfig-ld-mod.so" #define DSO_DIR "/tmp/tst-ldconfig" -#define CONF "/etc/ld.so.conf" static void @@ -64,6 +63,8 @@ do_test (void) { struct support_capture_subprocess result; + char *conf_path = xasprintf ("%s/ld.so.conf", support_sysconfdir_prefix); + /* Create the needed directories. */ xmkdirp ("/var/cache/ldconfig", 0777); xmkdirp (DSO_DIR, 0777); @@ -82,9 +83,9 @@ do_test (void) is not searched. */ TEST_VERIFY_EXIT (dlopen (DSO, RTLD_NOW | RTLD_GLOBAL) == NULL); - FILE *fp = xfopen (CONF, "a+"); + FILE *fp = xfopen (conf_path, "a+"); if (!fp) - FAIL_EXIT1 ("creating /etc/ld.so.conf failed: %m"); + FAIL_EXIT1 ("creating %s failed: %m", conf_path); xfclose (fp); /* Run ldconfig. */ @@ -95,9 +96,9 @@ do_test (void) TEST_VERIFY_EXIT (dlopen (DSO, RTLD_NOW | RTLD_GLOBAL) == NULL); /* Add tst-ldconfig directory to /etc/ld.so.conf. */ - fp = xfopen (CONF, "w"); + fp = xfopen (conf_path, "w"); if (!(fwrite (DSO_DIR, 1, sizeof (DSO_DIR), fp))) - FAIL_EXIT1 ("updating /etc/ld.so.conf failed: %m"); + FAIL_EXIT1 ("updating %s failed: %m", conf_path); xfclose (fp); /* Try to dlopen the same DSO again, we expect this to still fail. */ @@ -111,6 +112,8 @@ do_test (void) /* Finally, we expect dlopen to pass now. */ TEST_VERIFY_EXIT (dlopen (DSO, RTLD_NOW | RTLD_GLOBAL) != NULL); + free (conf_path); + return 0; }