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

dpkg: Pass default return value to reportbroken_retexitstatus()

This will allow to pass arbitrary values from the command actions when
there's not been any reported error.
Guillem Jover лет назад: 15
Родитель
Сommit
f6600ffa16
3 измененных файлов с 6 добавлено и 4 удалено
  1. 4 2
      src/errors.c
  2. 1 1
      src/main.c
  3. 1 1
      src/main.h

+ 4 - 2
src/errors.c

@@ -80,7 +80,9 @@ void print_error_perpackage(const char *emsg, const char *arg) {
   abort_processing = true;
   abort_processing = true;
 }
 }
 
 
-int reportbroken_retexitstatus(void) {
+int
+reportbroken_retexitstatus(int ret)
+{
   if (reports) {
   if (reports) {
     fputs(_("Errors were encountered while processing:\n"),stderr);
     fputs(_("Errors were encountered while processing:\n"),stderr);
     while (reports) {
     while (reports) {
@@ -91,7 +93,7 @@ int reportbroken_retexitstatus(void) {
   if (abort_processing) {
   if (abort_processing) {
     fputs(_("Processing was halted because there were too many errors.\n"),stderr);
     fputs(_("Processing was halted because there were too many errors.\n"),stderr);
   }
   }
-  return nerrs ? 1 : 0;
+  return nerrs ? 1 : ret;
 }
 }
 
 
 bool
 bool

+ 1 - 1
src/main.c

@@ -761,5 +761,5 @@ int main(int argc, const char *const *argv) {
 
 
   standard_shutdown();
   standard_shutdown();
 
 
-  return reportbroken_retexitstatus();
+  return reportbroken_retexitstatus(0);
 }
 }

+ 1 - 1
src/main.h

@@ -208,7 +208,7 @@ void cu_prermremove(int argc, void **argv);
 
 
 void print_error_perpackage(const char *emsg, const char *arg);
 void print_error_perpackage(const char *emsg, const char *arg);
 void forcibleerr(int forceflag, const char *format, ...) DPKG_ATTR_PRINTF(2);
 void forcibleerr(int forceflag, const char *format, ...) DPKG_ATTR_PRINTF(2);
-int reportbroken_retexitstatus(void);
+int reportbroken_retexitstatus(int ret);
 bool skip_due_to_hold(struct pkginfo *pkg);
 bool skip_due_to_hold(struct pkginfo *pkg);
 
 
 /* from help.c */
 /* from help.c */