Procházet zdrojové kódy

s-s-d: Make --quiet silence --test

Closes: #367998
Guillem Jover před 18 roky
rodič
revize
7a1da85bed
3 změnil soubory, kde provedl 16 přidání a 5 odebrání
  1. 7 0
      ChangeLog
  2. 1 0
      debian/changelog
  3. 8 5
      utils/start-stop-daemon.c

+ 7 - 0
ChangeLog

@@ -1,3 +1,10 @@
+2008-01-16  Guillem Jover  <guillem@debian.org>
+
+	* utils/start-stop-daemon.c (do_stop): Do not print messages when
+	running on quiet and test modes.
+	(run_stop_schedule): Likewise.
+	(main): Likewise.
+
 2008-01-16  Guillem Jover  <guillem@debian.org>
 
 	* utils/start-stop-daemon.c (do_pidfile): Cache pid value over

+ 1 - 0
debian/changelog

@@ -9,6 +9,7 @@ dpkg (1.14.16) UNRELEASED; urgency=low
   * Keep checking for the process when start-stop-daemon is called with
     --retry even if the daemon removed the pidfile. Closes: #460903
     Thanks to Justin Pryzby for the analysis.
+  * Make --quiet silence --test in start-stop-daemon. Closes: #367998
 
   [ Frank Lichtenheld ]
   * Make the -L option of dpkg-parsechangelog actually work (it's

+ 8 - 5
utils/start-stop-daemon.c

@@ -1078,8 +1078,9 @@ do_stop(int signal_nr, int quietmode, int *n_killed, int *n_notkilled, int retry
 
 	for (p = found; p; p = p->next) {
 		if (testmode) {
-			printf("Would send signal %d to %d.\n",
-			       signal_nr, p->pid);
+			if (quietmode <= 0)
+				printf("Would send signal %d to %d.\n",
+				       signal_nr, p->pid);
 			(*n_killed)++;
 		} else if (kill(p->pid, signal_nr) == 0) {
 			push(&killed, p->pid);
@@ -1117,7 +1118,8 @@ run_stop_schedule(void)
 
 	if (testmode) {
 		if (schedule != NULL) {
-			printf("Ignoring --retry in test mode\n");
+			if (quietmode <= 0)
+				printf("Ignoring --retry in test mode\n");
 			schedule = NULL;
 		}
 	}
@@ -1318,7 +1320,7 @@ main(int argc, char **argv)
 			printf("%s already running.\n", execname ? execname : "process");
 		exit(exitnodo);
 	}
-	if (testmode) {
+	if (testmode && quietmode <= 0) {
 		printf("Would start %s ", startas);
 		while (argc-- > 0)
 			printf("%s ", *argv++);
@@ -1334,8 +1336,9 @@ main(int argc, char **argv)
 		if (nicelevel)
 			printf(", and add %i to the priority", nicelevel);
 		printf(".\n");
-		exit(0);
 	}
+	if (testmode)
+		exit(0);
 	if (quietmode < 0)
 		printf("Starting %s...\n", startas);
 	*--argv = startas;