Skip to content

Commit 7421aa4

Browse files
committed
Explicit handle ignoring the return code for failed error messages
This gave a compiler warning.
1 parent 47efe69 commit 7421aa4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

judge/runguard.cc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,9 @@ void verbose(const char *format, ...)
233233
void verbose_from_signalhandler(const char* msg)
234234
{
235235
if (!be_quiet && be_verbose) {
236-
write(STDERR_FILENO, msg, strlen(msg));
236+
if (write(STDERR_FILENO, msg, strlen(msg) != 0)) {
237+
// We can't alert any further;
238+
}
237239
}
238240
}
239241

@@ -242,7 +244,9 @@ void warning_from_signalhandler(const char* msg)
242244
if (!be_quiet) {
243245
// Do not include timing here, as it wouldn't be safe from a signalhandler.
244246
// TODO: Consider rewriting using clock_gettime in the future.
245-
write(STDERR_FILENO, msg, strlen(msg));
247+
if (write(STDERR_FILENO, msg, strlen(msg)) != 0) {
248+
// We can't alert any further;
249+
}
246250
}
247251
}
248252

0 commit comments

Comments
 (0)