From patchwork Tue May 18 04:40:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddhesh Poyarekar X-Patchwork-Id: 1479939 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: 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@sourceware.org; receiver=) Authentication-Results: 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=E16Hfk+j; dkim-atps=neutral Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Fkjx8645pz9sWQ for ; Tue, 18 May 2021 14:40:44 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5E23F389683F; Tue, 18 May 2021 04:40:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5E23F389683F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1621312841; bh=LXCWfXQPw4cP08L1uYBJxEM9U5Q9c+YFqizWhgFhsjs=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=E16Hfk+jr8GS4TUj/iCYkAl3OGpOO7Von8i6JlxqpRguL+3nxnJRWibez3ZuSqVup Z6y0l4KyWz33RIbTZ87gSwLUcDDmMauZGWDiXRMMXQzXTLEjWpxpLpOCScIKd7zE/X I+KcgqoBZATWtTgU6Q1+rjED8TztBjSXHP5IOqCY= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from insect.birch.relay.mailchannels.net (insect.birch.relay.mailchannels.net [23.83.209.93]) by sourceware.org (Postfix) with ESMTPS id 2B098383D005 for ; Tue, 18 May 2021 04:40:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 2B098383D005 X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 5ACDA321BC5; Tue, 18 May 2021 04:40:37 +0000 (UTC) Received: from pdx1-sub0-mail-a84.g.dreamhost.com (100-101-162-48.trex.outbound.svc.cluster.local [100.101.162.48]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id AB1133214D3; Tue, 18 May 2021 04:40:36 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from pdx1-sub0-mail-a84.g.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384) by 100.101.162.48 (trex/6.2.1); Tue, 18 May 2021 04:40:37 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Irritate-Stop: 2a1c1fe86ead3f23_1621312836933_2827867093 X-MC-Loop-Signature: 1621312836932:201082241 X-MC-Ingress-Time: 1621312836932 Received: from pdx1-sub0-mail-a84.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a84.g.dreamhost.com (Postfix) with ESMTP id 4E3EF8844E; Mon, 17 May 2021 21:40:36 -0700 (PDT) Received: from rhbox.intra.reserved-bit.com (unknown [1.186.101.110]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a84.g.dreamhost.com (Postfix) with ESMTPSA id D53C789A8B; Mon, 17 May 2021 21:40:34 -0700 (PDT) X-DH-BACKEND: pdx1-sub0-mail-a84 To: libc-alpha@sourceware.org Subject: [COMMITTED 1/3] charmap_conversion: Free conversion table on exit Date: Tue, 18 May 2021 10:10:10 +0530 Message-Id: <20210518044012.910681-1-siddhesh@sourceware.org> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Spam-Status: No, score=-3494.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_NONE, KAM_DMARC_STATUS, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NEUTRAL, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Siddhesh Poyarekar via Libc-alpha From: Siddhesh Poyarekar Reply-To: Siddhesh Poyarekar Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" The conversion table is allocated using xcalloc but never freed. Reviewed-by: Adhemerval Zanella --- iconv/iconv_charmap.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/iconv/iconv_charmap.c b/iconv/iconv_charmap.c index f76b3ce2b1..e2d53fee3c 100644 --- a/iconv/iconv_charmap.c +++ b/iconv/iconv_charmap.c @@ -53,6 +53,12 @@ allocate_table (void) return (struct convtable *) xcalloc (1, sizeof (struct convtable)); } +static inline void +free_table (struct convtable *tbl) +{ + free (tbl); +} + static inline int is_term (struct convtable *tbl, unsigned int idx) @@ -228,6 +234,7 @@ charmap_conversion (const char *from_code, struct charmap_t *from_charmap, while (++remaining < argc); /* All done. */ + free_table (cvtbl); return status; } From patchwork Tue May 18 04:40:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddhesh Poyarekar X-Patchwork-Id: 1479940 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=) Authentication-Results: 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=ZSYxiVAk; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FkjxJ03XLz9sWW for ; Tue, 18 May 2021 14:40:51 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id F2DE63857011; Tue, 18 May 2021 04:40:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F2DE63857011 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1621312847; bh=tiKmhF6H+jiE862epppkGG1tFPtOVRU3Ko5hTQfO9eQ=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=ZSYxiVAkAgLqAfvsHWSHykQ9HdGpOKlYQIUQFZIxHyEkYcONZBi3YaKC2dF3Ote2h 8/sQRE06atUbGcYjHKAkye7hNA5Lc5kQoDcYBqkjltub0kUDZwMsOPDHttyGx8I+v1 sFDt+ryCaZtHEV4nAcXvVFA54l9iGfIG3tt65ZBM= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from insect.birch.relay.mailchannels.net (insect.birch.relay.mailchannels.net [23.83.209.93]) by sourceware.org (Postfix) with ESMTPS id D7D1D3857011 for ; Tue, 18 May 2021 04:40:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D7D1D3857011 X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 86477701766; Tue, 18 May 2021 04:40:42 +0000 (UTC) Received: from pdx1-sub0-mail-a84.g.dreamhost.com (100-105-161-139.trex.outbound.svc.cluster.local [100.105.161.139]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 2BA8D7016F2; Tue, 18 May 2021 04:40:42 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from pdx1-sub0-mail-a84.g.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384) by 100.105.161.139 (trex/6.2.1); Tue, 18 May 2021 04:40:42 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Scare-Eight: 4bf3c49a453208b7_1621312842414_592503046 X-MC-Loop-Signature: 1621312842414:447520034 X-MC-Ingress-Time: 1621312842414 Received: from pdx1-sub0-mail-a84.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a84.g.dreamhost.com (Postfix) with ESMTP id C01E289A8B; Mon, 17 May 2021 21:40:41 -0700 (PDT) Received: from rhbox.intra.reserved-bit.com (unknown [1.186.101.110]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a84.g.dreamhost.com (Postfix) with ESMTPSA id 176DA89A8A; Mon, 17 May 2021 21:40:39 -0700 (PDT) X-DH-BACKEND: pdx1-sub0-mail-a84 To: libc-alpha@sourceware.org Subject: [COMMITTED 2/3] ldconfig: Fix memory leaks Date: Tue, 18 May 2021 10:10:11 +0530 Message-Id: <20210518044012.910681-2-siddhesh@sourceware.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210518044012.910681-1-siddhesh@sourceware.org> References: <20210518044012.910681-1-siddhesh@sourceware.org> MIME-Version: 1.0 X-Spam-Status: No, score=-3494.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_NONE, KAM_DMARC_STATUS, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NEUTRAL, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Siddhesh Poyarekar via Libc-alpha From: Siddhesh Poyarekar Reply-To: Siddhesh Poyarekar Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" Coverity discovered that paths allocated by chroot_canon are not freed in a couple of routines in ldconfig. Reviewed-by: Adhemerval Zanella --- elf/ldconfig.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/elf/ldconfig.c b/elf/ldconfig.c index 28ed637a29..bd2b837ec2 100644 --- a/elf/ldconfig.c +++ b/elf/ldconfig.c @@ -709,16 +709,14 @@ manual_link (char *library) if (lstat64 (real_library, &stat_buf)) { error (0, errno, _("Cannot lstat %s"), library); - free (path); - return; + goto out; } /* We don't want links here! */ else if (!S_ISREG (stat_buf.st_mode)) { error (0, 0, _("Ignored file %s since it is not a regular file."), library); - free (path); - return; + goto out; } if (process_file (real_library, library, libname, &flag, &osversion, @@ -726,14 +724,16 @@ manual_link (char *library) { error (0, 0, _("No link created since soname could not be found for %s"), library); - free (path); - return; + goto out; } if (soname == NULL) soname = implicit_soname (libname, flag); create_links (real_path, path, libname, soname); free (soname); +out: free (path); + if (path != real_path) + free (real_path); } @@ -920,8 +920,16 @@ search_dir (const struct dir_entry *entry) /* Remove stale symlinks. */ if (opt_link && strstr (direntry->d_name, ".so.")) unlink (real_file_name); + + if (opt_chroot != NULL) + free (target_name); + continue; } + + if (opt_chroot != NULL) + free (target_name); + is_dir = S_ISDIR (stat_buf.st_mode); /* lstat_buf is later stored, update contents. */ From patchwork Tue May 18 04:40:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddhesh Poyarekar X-Patchwork-Id: 1479941 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=) Authentication-Results: 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=e68Lr9NA; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FkjxN4lmdz9sW1 for ; Tue, 18 May 2021 14:40:56 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8C5D2395205E; Tue, 18 May 2021 04:40:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8C5D2395205E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1621312854; bh=U+ccEoeuRZBrGotxjFa9FbSJbMACINCfKzPfAL+LQ1s=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=e68Lr9NA6ms4jkygEXnwLDMrLUG95M+qoS7d6a6rWp7psXzhlWTuTHZGM1OwxFLLQ fk3qb8VU02Wrk6DbW1UpM4wr2OLILtQ5uK1X8SSLGn1qVzrRTJgw6VNnHH3kDDu81y rJK0w9uWpmC45gKMJnzHRdAyNpUbnJVwmvaJHh98= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from aye.elm.relay.mailchannels.net (aye.elm.relay.mailchannels.net [23.83.212.6]) by sourceware.org (Postfix) with ESMTPS id 9BCDE395205E for ; Tue, 18 May 2021 04:40:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 9BCDE395205E X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 7FF15481FA3 for ; Tue, 18 May 2021 04:40:50 +0000 (UTC) Received: from pdx1-sub0-mail-a84.g.dreamhost.com (100-101-162-48.trex.outbound.svc.cluster.local [100.101.162.48]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 1DAFE482211 for ; Tue, 18 May 2021 04:40:50 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from pdx1-sub0-mail-a84.g.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384) by 100.101.162.48 (trex/6.2.1); Tue, 18 May 2021 04:40:50 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Reign-Absorbed: 6e1bd73b44f2fd88_1621312850391_231288348 X-MC-Loop-Signature: 1621312850391:2915792958 X-MC-Ingress-Time: 1621312850391 Received: from pdx1-sub0-mail-a84.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a84.g.dreamhost.com (Postfix) with ESMTP id C92C38844E for ; Mon, 17 May 2021 21:40:49 -0700 (PDT) Received: from rhbox.intra.reserved-bit.com (unknown [1.186.101.110]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a84.g.dreamhost.com (Postfix) with ESMTPSA id BDD9B89A8A for ; Mon, 17 May 2021 21:40:48 -0700 (PDT) X-DH-BACKEND: pdx1-sub0-mail-a84 To: libc-alpha@sourceware.org Subject: [COMMITTED 3/3] ldconfig: Avoid boolean coercion of opt_chroot Date: Tue, 18 May 2021 10:10:12 +0530 Message-Id: <20210518044012.910681-3-siddhesh@sourceware.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210518044012.910681-1-siddhesh@sourceware.org> References: <20210518044012.910681-1-siddhesh@sourceware.org> MIME-Version: 1.0 X-Spam-Status: No, score=-3494.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_NONE, KAM_DMARC_STATUS, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NEUTRAL, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Siddhesh Poyarekar via Libc-alpha From: Siddhesh Poyarekar Reply-To: Siddhesh Poyarekar Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" Generated code is unchanged. --- elf/ldconfig.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/elf/ldconfig.c b/elf/ldconfig.c index bd2b837ec2..96bf7700b2 100644 --- a/elf/ldconfig.c +++ b/elf/ldconfig.c @@ -505,7 +505,7 @@ add_dir_1 (const char *line, const char *from_file, int from_line) return; char *path = entry->path; - if (opt_chroot) + if (opt_chroot != NULL) path = chroot_canon (opt_chroot, path); struct stat64 stat_buf; @@ -526,7 +526,7 @@ add_dir_1 (const char *line, const char *from_file, int from_line) add_glibc_hwcaps_subdirectories (entry, path); } - if (opt_chroot) + if (opt_chroot != NULL) free (path); } @@ -575,7 +575,7 @@ create_links (const char *real_path, const char *path, const char *libname, full_soname = alloca (strlen (path) + strlen (soname) + 2); sprintf (full_libname, "%s/%s", path, libname); sprintf (full_soname, "%s/%s", path, soname); - if (opt_chroot) + if (opt_chroot != NULL) { real_full_libname = alloca (strlen (real_path) + strlen (libname) + 2); real_full_soname = alloca (strlen (real_path) + strlen (soname) + 2); @@ -687,7 +687,7 @@ manual_link (char *library) strcpy (path, "."); } - if (opt_chroot) + if (opt_chroot != NULL) { real_path = chroot_canon (opt_chroot, path); if (real_path == NULL) @@ -804,7 +804,7 @@ search_dir (const struct dir_entry *entry) size_t real_file_name_len; size_t file_name_len = PATH_MAX; char *file_name = alloca (file_name_len); - if (opt_chroot) + if (opt_chroot != NULL) { dir_name = chroot_canon (opt_chroot, entry->path); real_file_name_len = PATH_MAX; @@ -822,7 +822,7 @@ search_dir (const struct dir_entry *entry) { if (opt_verbose) error (0, errno, _("Can't open directory %s"), entry->path); - if (opt_chroot && dir_name) + if (opt_chroot != NULL && dir_name != NULL) free (dir_name); return; } @@ -872,7 +872,7 @@ search_dir (const struct dir_entry *entry) real_file_name = file_name; } sprintf (file_name, "%s/%s", entry->path, direntry->d_name); - if (opt_chroot) + if (opt_chroot != NULL) { len = strlen (dir_name) + strlen (direntry->d_name) + 2; if (len > real_file_name_len) @@ -902,7 +902,7 @@ search_dir (const struct dir_entry *entry) /* In case of symlink, we check if the symlink refers to a directory. */ char *target_name = real_file_name; - if (opt_chroot) + if (opt_chroot != NULL) { target_name = chroot_canon (opt_chroot, file_name); if (target_name == NULL) @@ -964,7 +964,7 @@ search_dir (const struct dir_entry *entry) continue; char *real_name; - if (opt_chroot && is_link) + if (opt_chroot != NULL && is_link) { real_name = chroot_canon (opt_chroot, file_name); if (real_name == NULL) @@ -1178,7 +1178,7 @@ search_dir (const struct dir_entry *entry) free (dlib_ptr); } - if (opt_chroot && dir_name) + if (opt_chroot != NULL && dir_name != NULL) free (dir_name); } @@ -1297,7 +1297,7 @@ static void parse_conf_include (const char *config_file, unsigned int lineno, bool do_chroot, const char *pattern) { - if (opt_chroot && pattern[0] != '/') + if (opt_chroot != NULL && pattern[0] != '/') error (EXIT_FAILURE, 0, _("need absolute file name for configuration file when using -r")); @@ -1395,7 +1395,7 @@ main (int argc, char **argv) set_hwcap (); - if (opt_chroot) + if (opt_chroot != NULL) { /* Normalize the path a bit, we might need it for printing later. */ char *endp = rawmemchr (opt_chroot, '\0'); @@ -1405,7 +1405,7 @@ main (int argc, char **argv) if (endp == opt_chroot) opt_chroot = NULL; - if (opt_chroot) + if (opt_chroot != NULL) { /* It is faster to use chroot if we can. */ if (!chroot (opt_chroot)) @@ -1428,7 +1428,7 @@ main (int argc, char **argv) if (opt_print_cache) { - if (opt_chroot) + if (opt_chroot != NULL) { char *p = chroot_canon (opt_chroot, cache_file); if (p == NULL) @@ -1437,12 +1437,12 @@ main (int argc, char **argv) cache_file = p; } print_cache (cache_file); - if (opt_chroot) + if (opt_chroot != NULL) free (cache_file); exit (0); } - if (opt_chroot) + if (opt_chroot != NULL) { /* Canonicalize the directory name of cache_file, not cache_file, because we'll rename a temporary cache file to it. */ @@ -1491,7 +1491,7 @@ main (int argc, char **argv) } const char *aux_cache_file = _PATH_LDCONFIG_AUX_CACHE; - if (opt_chroot) + if (opt_chroot != NULL) aux_cache_file = chroot_canon (opt_chroot, aux_cache_file); if (! opt_ignore_aux_cache && aux_cache_file)