[Reproducible-commits] [dpkg] 08/54: dpkg-trigger: Move exit from command function to its call site

Mattia Rizzolo mattia at debian.org
Fri Jan 15 18:53:58 UTC 2016


This is an automated email from the git hooks/post-receive script.

mattia pushed a commit to branch pu/reproducible_builds
in repository dpkg.

commit df5deb4f20c96ffd573e8900de6981a2c3024b2a
Author: Guillem Jover <guillem at debian.org>
Date:   Wed Oct 21 16:54:29 2015 +0200

    dpkg-trigger: Move exit from command function to its call site
    
    This makes it explicit that the code flow stops at the call site instead
    of requiring the reader to know that this specific function never returns.
---
 src/trigcmd.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/trigcmd.c b/src/trigcmd.c
index 110fd7b..312cd87 100644
--- a/src/trigcmd.c
+++ b/src/trigcmd.c
@@ -168,7 +168,7 @@ static const struct trigdefmeths tdm_add = {
 	.trig_end = tdm_add_trig_end,
 };
 
-static void DPKG_ATTR_NORET
+static int
 do_check(void)
 {
 	enum trigdef_update_status uf;
@@ -177,13 +177,13 @@ do_check(void)
 	switch (uf) {
 	case TDUS_ERROR_NO_DIR:
 		notice(_("triggers data directory not yet created"));
-		exit(1);
+		return 1;
 	case TDUS_ERROR_NO_DEFERRED:
 		notice(_("trigger records not yet in existence"));
-		exit(1);
+		return 1;
 	case TDUS_OK:
 	case TDUS_ERROR_EMPTY_DEFERRED:
-		exit(0);
+		return 0;
 	default:
 		internerr("unknown trigdef_update_start return value '%d'", uf);
 	}
@@ -218,7 +218,7 @@ main(int argc, const char *const *argv)
 		if (*argv)
 			badusage(_("--%s takes no arguments"),
 			         "check-supported");
-		do_check();
+		return do_check();
 	}
 
 	if (!*argv || argv[1])

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git



More information about the Reproducible-commits mailing list