From c0627b3fceacfa1ed162f5f55235360ea26f569a Mon Sep 17 00:00:00 2001 From: Lasse Collin Date: Mon, 1 Jul 2013 14:34:11 +0300 Subject: xz: Silence a warning seen with _FORTIFY_SOURCE=2. Thanks to Christian Hesse. --- src/xz/file_io.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/xz/file_io.c b/src/xz/file_io.c index 9b0942c2..9db7dc58 100644 --- a/src/xz/file_io.c +++ b/src/xz/file_io.c @@ -98,8 +98,14 @@ io_init(void) extern void io_write_to_user_abort_pipe(void) { + // If the write() fails, it's probably due to the pipe being full. + // Failing in that case is fine. If the reason is something else, + // there's not much we can do since this is called in a signal + // handler. So ignore the errors and try to avoid warnings with + // GCC and glibc when _FORTIFY_SOURCE=2 is used. uint8_t b = '\0'; - (void)write(user_abort_pipe[1], &b, 1); + const int ret = write(user_abort_pipe[1], &b, 1); + (void)ret; return; } #endif -- cgit v1.2.3