public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Anthony G. Basile" <blueness@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/elfix:master commit in: misc/install.wrapper.c/
Date: Mon, 20 Jan 2014 19:02:47 +0000 (UTC)	[thread overview]
Message-ID: <1390244537.c19d16ffe0d00b555b0b5f63da1ae683bca049b0.blueness@gentoo> (raw)

commit:     c19d16ffe0d00b555b0b5f63da1ae683bca049b0
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 20 19:02:17 2014 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> 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 - <blueness@gentoo.org>
+ * Copyright 2014 Mike Frysinger    - <vapier@gentoo.org>
  *
  * 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. */
+
+	}
 }


             reply	other threads:[~2014-01-20 19:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-20 19:02 Anthony G. Basile [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-02-07 18:10 [gentoo-commits] proj/elfix:master commit in: misc/install.wrapper.c/ Anthony G. Basile
2014-02-07 18:10 Anthony G. Basile
2014-01-18 23:39 Anthony G. Basile
2014-01-18 23:25 Anthony G. Basile
2014-01-18 20:57 Anthony G. Basile
2014-01-18 20:30 Anthony G. Basile
2014-01-18 20:23 Anthony G. Basile
2014-01-18 20:06 Anthony G. Basile
2014-01-18 13:18 Anthony G. Basile
2014-01-18 13:18 Anthony G. Basile

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1390244537.c19d16ffe0d00b555b0b5f63da1ae683bca049b0.blueness@gentoo \
    --to=blueness@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox