From patchwork Mon Apr 11 19:45:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: DJ Delorie X-Patchwork-Id: 52797 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BCDF73856DF6 for ; Mon, 11 Apr 2022 19:45:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BCDF73856DF6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1649706358; bh=AVxbPZ6w/p3QJH0RzAQHMkDjjPjGJg95xN3aD3V0svk=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=MuYY8/lmJHUBx9nh2clZzFzUy7SrEIphs0rp/9d1tXL8jWR2keZ0FJEm1Zd3uNati fPL3U0KM2RvnI8BFAagfyaV0cZ1RxtCk4IClr4rfIROgEra/TiP9cNCypGysO5jHXy E9RWZMR/sl+2aG7+rQCfvP7IlXbovu5qRHX17drM= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org 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 B75EE3858D1E for ; Mon, 11 Apr 2022 19:45:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B75EE3858D1E Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-551-auHdSH96O1e0UE69KDFPOQ-1; Mon, 11 Apr 2022 15:45:36 -0400 X-MC-Unique: auHdSH96O1e0UE69KDFPOQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EFDDF2A5956A for ; Mon, 11 Apr 2022 19:45:35 +0000 (UTC) Received: from greed.delorie.com (ovpn-112-4.rdu2.redhat.com [10.10.112.4]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DA8C31415133 for ; Mon, 11 Apr 2022 19:45:35 +0000 (UTC) Received: from greed.delorie.com.redhat.com (localhost [127.0.0.1]) by greed.delorie.com (8.15.2/8.15.2) with ESMTP id 23BJjZOQ222266 for ; Mon, 11 Apr 2022 15:45:35 -0400 To: libc-alpha@sourceware.org Subject: test-container: Fix "unused code" warnings on HURD Date: Mon, 11 Apr 2022 15:45:35 -0400 Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.4 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_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: DJ Delorie via Libc-alpha From: DJ Delorie Reply-To: DJ Delorie Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" [mix of my previous patch plus fixing Florian's reported bug] [I tried to install HURD locally in a VM and couldn't, so... untested on HURD] Comment out bits of code that are only used when we *have* pid namespaces, to avoid "unused code" warnings. diff --git a/support/test-container.c b/support/test-container.c index c837c4d758..7557aac441 100644 --- a/support/test-container.c +++ b/support/test-container.c @@ -230,6 +230,7 @@ concat (const char *str, ...) return bufs[n]; } +#ifdef CLONE_NEWNS /* Like the above, but put spaces between words. Caller frees. */ static char * concat_words (char **words, int num_words) @@ -255,6 +256,7 @@ concat_words (char **words, int num_words) return rv; } +#endif /* Try to mount SRC onto DEST. */ static void @@ -756,7 +758,9 @@ main (int argc, char **argv) /* If set, the test runs as root instead of the user running the testsuite. */ int be_su = 0; int require_pidns = 0; +#ifdef CLONE_NEWNS const char *pidns_comment = NULL; +#endif int do_proc_mounts = 0; int UMAP; int GMAP; @@ -1046,8 +1050,10 @@ main (int argc, char **argv) else if (nt >= 1 && strcmp (the_words[0], "pidns") == 0) { require_pidns = 1; +#ifdef CLONE_NEWNS if (nt > 1) pidns_comment = concat_words (the_words + 1, nt - 1); +#endif } else if (nt == 3 && strcmp (the_words[0], "mkdirp") == 0) {