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
+
1
3
#if !__CHECK_OUTPUT__ || !__I_AM_SANITIZER1__
2
4
3
5
static int init_check_output (void ) {
@@ -11,11 +13,14 @@ static void __dcc_check_close(int fd) {
11
13
}
12
14
13
15
static 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
+ }
16
20
}
17
21
18
22
static void disable_check_output (void ) {
23
+ expected_stdout = NULL ;
19
24
}
20
25
21
26
#else
@@ -27,8 +32,6 @@ static void disable_check_output(void) {
27
32
//lins longer than this will produce an error if output checking enabled
28
33
#define ACTUAL_LINE_MAX 65536
29
34
30
- static unsigned char * expected_stdout ;
31
-
32
35
static int ignore_case ;
33
36
static int ignore_empty_lines ;
34
37
static int ignore_trailing_white_space ;
@@ -118,7 +121,7 @@ static void __dcc_check_close(int fd) {
118
121
}
119
122
120
123
static void __dcc_check_output_exit (void ) {
121
- debug_printf (3 , "__dcc_cleanup_before_exit \n" );
124
+ debug_printf (3 , "__dcc_check_output_exit \n" );
122
125
if (expected_stdout ) {
123
126
fflush (stdout );
124
127
__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) {
141
141
if (synchronization_terminated ) {
142
142
return ;
143
143
}
144
- // sanitizer2 sends SIGUSR1 if its printing an error
145
- signal (SIGUSR1 , SIG_IGN );
146
- signal (SIGPIPE , SIG_IGN );
147
144
#if __I_AM_SANITIZER1__
148
145
close (to_sanitizer2_pipe [1 ]);
149
146
close (from_sanitizer2_pipe [0 ]);
@@ -164,6 +161,9 @@ static void wait_for_sanitizer2_to_terminate(void) {
164
161
set_signals_default ();
165
162
debug_printf (3 , "waiting\n" );
166
163
if (!sanitizer2_killed ) {
164
+ // sanitizer2 sends SIGUSR1 if its printing an error
165
+ signal (SIGUSR1 , SIG_IGN );
166
+ signal (SIGPIPE , SIG_IGN );
167
167
pid_t pid = wait (NULL );
168
168
debug_printf (3 , "wait returned %d\n" , pid );
169
169
if (pid != sanitizer2_pid ) {
Original file line number Diff line number Diff line change @@ -186,6 +186,7 @@ static void set_signals_default(void) {
186
186
}
187
187
188
188
static void __dcc_signal_handler (int signum ) {
189
+ debug_printf (2 , "received signal %d\n" , signum );
189
190
set_signals_default ();
190
191
#if __N_SANITIZERS__ > 1
191
192
#if __I_AM_SANITIZER1__
@@ -196,7 +197,6 @@ static void __dcc_signal_handler(int signum) {
196
197
__dcc_error_exit ();
197
198
}
198
199
} else if (signum == SIGUSR1 ) {
199
- debug_printf (2 , "received SIGUSR\n" );
200
200
__dcc_error_exit ();
201
201
}
202
202
#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 .
2
2
3
3
For example, this program prints the ** EOF** value before the loop exits:
4
4
You can’t perform that action at this time.
0 commit comments