From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 4B674138247 for ; Mon, 20 Jan 2014 19:02:51 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id F39A5E0F5F; Mon, 20 Jan 2014 19:02:49 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 8D120E0F5F for ; Mon, 20 Jan 2014 19:02:49 +0000 (UTC) Received: from spoonbill.gentoo.org (spoonbill.gentoo.org [81.93.255.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 9770F33F9ED for ; Mon, 20 Jan 2014 19:02:48 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by spoonbill.gentoo.org (Postfix) with ESMTP id 275551871B for ; Mon, 20 Jan 2014 19:02:47 +0000 (UTC) From: "Anthony G. Basile" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Anthony G. Basile" Message-ID: <1390244537.c19d16ffe0d00b555b0b5f63da1ae683bca049b0.blueness@gentoo> Subject: [gentoo-commits] proj/elfix:master commit in: misc/install.wrapper.c/ X-VCS-Repository: proj/elfix X-VCS-Files: misc/install.wrapper.c/install.wrapper.c X-VCS-Directories: misc/install.wrapper.c/ X-VCS-Committer: blueness X-VCS-Committer-Name: Anthony G. Basile X-VCS-Revision: c19d16ffe0d00b555b0b5f63da1ae683bca049b0 X-VCS-Branch: master Date: Mon, 20 Jan 2014 19:02:47 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 18be5c37-9db9-46d6-bf3c-4c514e2f6db6 X-Archives-Hash: 1eafad8d2323a144db64be82c9d54abb commit: c19d16ffe0d00b555b0b5f63da1ae683bca049b0 Author: Anthony G. Basile gentoo org> AuthorDate: Mon Jan 20 19:02:17 2014 +0000 Commit: Anthony G. Basile gentoo org> CommitDate: Mon Jan 20 19:02:17 2014 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/elfix.git;a=commit;h=c19d16ff misc/install.wrapper.c: pass the signal back up the call stack We follow the advice at http://www.cons.org/cracauer/sigint.html and pass the signal back up to the process call stack. --- misc/install.wrapper.c/install.wrapper.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/misc/install.wrapper.c/install.wrapper.c b/misc/install.wrapper.c/install.wrapper.c index df2b387..f0425f9 100644 --- a/misc/install.wrapper.c/install.wrapper.c +++ b/misc/install.wrapper.c/install.wrapper.c @@ -2,6 +2,7 @@ * Distributed under the terms of the GNU General Public License v2 * * Copyright 2014 Anthony G. Basile - + * Copyright 2014 Mike Frysinger - * * Wrapper for coreutil's install to preserve extended attributes. */ @@ -296,7 +297,6 @@ main(int argc, char* argv[]) default: wait(&status); - status = WEXITSTATUS(status); /* Are there enough files/directories on the cmd line to * proceed? This can happen if install is called with no @@ -304,11 +304,11 @@ main(int argc, char* argv[]) * nothing for the parent to do. */ if (first >= last) - return status; + goto done; /* If all the targets are directories, do nothing. */ if (opts_directory) - return status; + goto done; if (!opts_target_directory) { target = argv[last]; @@ -344,9 +344,18 @@ main(int argc, char* argv[]) } else copyxattr(argv[first], target); - return status; - } - /* We should never get here. */ - return EXIT_FAILURE; + done: + /* Do the right thing and pass the signal back up. See: + * http://www.cons.org/cracauer/sigint.html + */ + if (WIFSIGNALED(status)) { + int signum = WTERMSIG(status); + kill(getpid(), signum); + } else if (WIFEXITED(status)) + return WEXITSTATUS(status); + else + return EXIT_FAILURE; /* We should never get here. */ + + } }