File tree Expand file tree Collapse file tree 4 files changed +13
-10
lines changed Expand file tree Collapse file tree 4 files changed +13
-10
lines changed Original file line number Diff line number Diff line change 1+ static unsigned char * expected_stdout ;
2+
13#if !__CHECK_OUTPUT__ || !__I_AM_SANITIZER1__
24
35static int init_check_output (void ) {
@@ -11,11 +13,14 @@ static void __dcc_check_close(int fd) {
1113}
1214
1315static void __dcc_check_output_exit (void ) {
14- debug_printf (3 , "__dcc_cleanup_before_exit\n" );
15- fflush (stdout );
16+ debug_printf (3 , "__dcc_check_output_exit\n" );
17+ if (expected_stdout ) {
18+ fflush (stdout );
19+ }
1620}
1721
1822static void disable_check_output (void ) {
23+ expected_stdout = NULL ;
1924}
2025
2126#else
@@ -27,8 +32,6 @@ static void disable_check_output(void) {
2732//lins longer than this will produce an error if output checking enabled
2833#define ACTUAL_LINE_MAX 65536
2934
30- static unsigned char * expected_stdout ;
31-
3235static int ignore_case ;
3336static int ignore_empty_lines ;
3437static int ignore_trailing_white_space ;
@@ -118,7 +121,7 @@ static void __dcc_check_close(int fd) {
118121}
119122
120123static void __dcc_check_output_exit (void ) {
121- debug_printf (3 , "__dcc_cleanup_before_exit \n" );
124+ debug_printf (3 , "__dcc_check_output_exit \n" );
122125 if (expected_stdout ) {
123126 fflush (stdout );
124127 __dcc_check_all_output_seen_at_exit ();
Original file line number Diff line number Diff line change @@ -141,9 +141,6 @@ static void disconnect_sanitizers(void) {
141141 if (synchronization_terminated ) {
142142 return ;
143143 }
144- // sanitizer2 sends SIGUSR1 if its printing an error
145- signal (SIGUSR1 , SIG_IGN );
146- signal (SIGPIPE , SIG_IGN );
147144#if __I_AM_SANITIZER1__
148145 close (to_sanitizer2_pipe [1 ]);
149146 close (from_sanitizer2_pipe [0 ]);
@@ -164,6 +161,9 @@ static void wait_for_sanitizer2_to_terminate(void) {
164161 set_signals_default ();
165162 debug_printf (3 , "waiting\n" );
166163 if (!sanitizer2_killed ) {
164+ // sanitizer2 sends SIGUSR1 if its printing an error
165+ signal (SIGUSR1 , SIG_IGN );
166+ signal (SIGPIPE , SIG_IGN );
167167 pid_t pid = wait (NULL );
168168 debug_printf (3 , "wait returned %d\n" , pid );
169169 if (pid != sanitizer2_pid ) {
Original file line number Diff line number Diff line change @@ -186,6 +186,7 @@ static void set_signals_default(void) {
186186}
187187
188188static void __dcc_signal_handler (int signum ) {
189+ debug_printf (2 , "received signal %d\n" , signum );
189190 set_signals_default ();
190191#if __N_SANITIZERS__ > 1
191192#if __I_AM_SANITIZER1__
@@ -196,7 +197,6 @@ static void __dcc_signal_handler(int signum) {
196197 __dcc_error_exit ();
197198 }
198199 } else if (signum == SIGUSR1 ) {
199- debug_printf (2 , "received SIGUSR\n" );
200200 __dcc_error_exit ();
201201 }
202202#else
Original file line number Diff line number Diff line change 1- Accidentally printing the special ** EOF** value returned by the functions _ getchar_ , _ getc_ and _ fgetc_ .
1+ Accidentally printing the special ** EOF** value returned by the functions _ getchar_ , _ getc_ and _ fgetc_ is common bug .
22
33For example, this program prints the ** EOF** value before the loop exits:
44
You can’t perform that action at this time.
0 commit comments