Просмотр исходного кода

s-s-d: Do not allow a --retry schedule where forever is the last item

The forever item needs something to repeat over, otherwise we just get
an infinite loop doing nothing.

Closes: #570938
Guillem Jover лет назад: 16
Родитель
Сommit
4ecd0ef5d2
2 измененных файлов с 5 добавлено и 0 удалено
  1. 2 0
      debian/changelog
  2. 3 0
      utils/start-stop-daemon.c

+ 2 - 0
debian/changelog

@@ -6,6 +6,8 @@ dpkg (1.15.6.1) UNRELEASED; urgency=low
     avoid exposing the configure variable HAVE_C99 on installed headers.
   * Use __attribute__ keyword depending on compiler support, we avoid
     exposing the configure variable HAVE_C_ATTRIBUTE on installed headers.
+  * Do not allow a --retry schedule in start-stop-daemon where forever is
+    the last item, as it needs something to repeat over. Closes: #570938
 
   [ Raphaël Hertzog ]
   * Accept source packages without "Format" field for compatibility with very

+ 3 - 0
utils/start-stop-daemon.c

@@ -686,6 +686,9 @@ parse_schedule(const char *schedule_str)
 			}
 			count++;
 		}
+		if (repeatat == count)
+			badusage("invalid schedule: 'forever' appears last, "
+			         "nothing to repeat");
 		if (repeatat >= 0) {
 			schedule[count].type = sched_goto;
 			schedule[count].value = repeatat;