Quellcode durchsuchen

dpkg-divert: Return from a command function instead of directly exiting

This makes it possible to perform any necessary normal cleanup before
exiting, and unifies the usage with all other command functions.
Guillem Jover vor 11 Jahren
Ursprung
Commit
97a8d2695c
2 geänderte Dateien mit 4 neuen und 2 gelöschten Zeilen
  1. 2 0
      debian/changelog
  2. 2 2
      src/divertcmd.c

+ 2 - 0
debian/changelog

@@ -11,6 +11,8 @@ dpkg (1.18.4) UNRELEASED; urgency=low
   * Fix memory leaks in «dpkg --verify» and dpkg infodb format upgrade logic.
   * Merge all update-alternatives action handling into a single if-else-if
     block, to unify the code an allow a future switch into a shared library.
+  * Perform any necessary cleanups on normal exit from dpkg-divert --add and
+    --remove commands.
   * Build system:
     - Set PERL5LIB globally for the test suite to the local modules directory,
       to avoid using the system modules. Regression introduced in dpkg 1.17.8.

+ 2 - 2
src/divertcmd.c

@@ -464,7 +464,7 @@ diversion_add(const char *const *argv)
 			if (opt_verbose > 0)
 				printf(_("Leaving '%s'\n"),
 				       diversion_describe(fnn_from->divert));
-			exit(0);
+			return 0;
 		}
 
 		ohshit(_("'%s' clashes with '%s'"),
@@ -595,7 +595,7 @@ diversion_remove(const char *const *argv)
 		if (opt_verbose > 0)
 			printf(_("Ignoring request to remove shared diversion '%s'.\n"),
 			       diversion_describe(contest));
-		exit(0);
+		return 0;
 	}
 
 	if (opt_verbose > 0)