瀏覽代碼

Move error context display handler reset to error_unwind()

Never print an error message when doing normal cleanup, as this is
something we always want to do.
Guillem Jover 16 年之前
父節點
當前提交
2272d41169
共有 7 個文件被更改,包括 7 次插入6 次删除
  1. 0 1
      lib/dpkg/dpkg.h
  2. 4 0
      lib/dpkg/ehandle.c
  3. 0 1
      lib/dpkg/test.h
  4. 1 1
      src/archives.c
  5. 1 1
      src/main.c
  6. 1 1
      src/packages.c
  7. 0 1
      src/trigproc.c

+ 0 - 1
lib/dpkg/dpkg.h

@@ -115,7 +115,6 @@ DPKG_BEGIN_DECLS
 } while (0)
 
 #define standard_shutdown() do { \
-  set_error_display(NULL, NULL); \
   error_unwind(ehflag_normaltidy);\
 } while (0)
 

+ 4 - 0
lib/dpkg/ehandle.c

@@ -242,6 +242,10 @@ void error_unwind(int flagset) {
 
   tecp= econtext;
   econtext= tecp->next;
+
+  /* If we are cleaning up normally, do not print anything. */
+  if (flagset & ehflag_normaltidy)
+    set_error_printer(tecp, NULL, NULL);
   run_cleanups(tecp,flagset);
   free(tecp);
 }

+ 0 - 1
lib/dpkg/test.h

@@ -54,7 +54,6 @@ main(int argc, char **argv)
 	test();
 
 	/* Shutdown. */
-	set_error_display(NULL, NULL);
 	error_unwind(ehflag_normaltidy);
 
 	return 0;

+ 1 - 1
src/archives.c

@@ -1258,7 +1258,7 @@ void archivefiles(const char *const *argv) {
     m_output(stdout, _("<standard output>"));
     m_output(stderr, _("<standard error>"));
     onerr_abort--;
-    set_error_display(NULL, NULL);
+
     error_unwind(ehflag_normaltidy);
   }
 

+ 1 - 1
src/main.c

@@ -658,7 +658,7 @@ void commandfd(const char *const *argv) {
 
     actionfunction= (void (*)(const char* const*))cipaction->farg;
     actionfunction(newargs);
-    set_error_display(NULL, NULL);
+
     error_unwind(ehflag_normaltidy);
   }
 }

+ 1 - 1
src/packages.c

@@ -248,7 +248,7 @@ void process_queue(void) {
     }
     m_output(stdout, _("<standard output>"));
     m_output(stderr, _("<standard error>"));
-    set_error_display(NULL, NULL);
+
     error_unwind(ehflag_normaltidy);
   }
   assert(!queue.length);

+ 0 - 1
src/trigproc.c

@@ -122,7 +122,6 @@ trigproc_run_deferred(void)
 		pkg->clientdata->trigprocdeferred = NULL;
 		trigproc(pkg);
 
-		set_error_display(NULL, NULL);
 		error_unwind(ehflag_normaltidy);
 	}
 }