From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 75093 invoked by alias); 12 Dec 2019 13:18:39 -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 75082 invoked by uid 89); 12 Dec 2019 13:18:38 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-6.1 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.1 spammy= X-HELO: us-smtp-1.mimecast.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576156716; 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=wA6trBvqda5IRdz+y+a0Mkm63EXB5urWw0Wdw3kPUfo=; b=Hh9/U/7wBsnEk6soCSWpzHVwaJ1vjAj5s44zmx1ihY5X748WVHmDMvJEAXvjLIdWAVb/Eq 1/B5GTIDNFYrIKLMtjwWY/ohN5pw2vUU4Mj5OnEtSWWOp2MvzTCJG9AP8grfbBBSOsZ5Um kUTWTQEu73KxVahUSwnLT0ShBkzCmZs= From: Florian Weimer To: DJ Delorie Cc: libc-alpha@sourceware.org Subject: Re: V2 test-container: ability to specify exec path References: Date: Thu, 12 Dec 2019 13:18:00 -0000 In-Reply-To: (DJ Delorie's message of "Wed, 11 Dec 2019 16:43:13 -0500") Message-ID: <87r219fzrs.fsf@oldenburg2.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable X-SW-Source: 2019-12/txt/msg00414.txt.bz2 * DJ Delorie: > + /* Find the base name of the test. */ > + if (strrchr (test_basename, '/') !=3D NULL) > + test_basename =3D strrchr (test_basename, '/') + 1; Can you use the basename function here? > + /* If the new exec path ends with a slash, that's the > + * directory, and use the old test base name. */ > + if (new_exec_path [strlen(new_exec_path) - 1] =3D=3D '/') > + new_exec_path =3D concat (new_exec_path, > + test_basename, > + NULL); > + > + > + /* new_child_proc is in the build tree, so has the > + same path inside the chroot as outside. The new > + exec path is, by definition, relative to the > + chroot. */ > + copy_one_file (new_child_proc[0], concat (new_root_path, > + new_exec_path, > + NULL)); > + > + new_child_exec =3D strdup (new_exec_path); > + if (the_words[2]) > + new_child_proc[0] =3D strdup (the_words[2]); > + else > + new_child_proc[0] =3D new_child_exec; > + } > + else if (nt =3D=3D 2 && strcmp (the_words[0], "cwd") =3D=3D 0) > + { > + change_cwd =3D strdup (the_words[1]); Use xstrdup (twice)? Rest looks okay to me, based on cursory glance. Thanks, Florian