From fb3762ee972b2932899f42dd797b99629040c27e Mon Sep 17 00:00:00 2001 From: Chris Spiegel Date: Sat, 31 Jan 2015 22:51:11 -0800 Subject: [PATCH 1/2] Clear sa_mask and sa_handler before calling sigaction(). --- main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main.c b/main.c index 9b037b7..945f39f 100644 --- a/main.c +++ b/main.c @@ -434,6 +434,8 @@ int main(int argc, char *argv[]) if (STDIN) control->inFILE = stdin; /* Implement signal handler only once flags are set */ + sigemptyset(&handler.sa_mask); + handler.sa_flags = 0; handler.sa_handler = &sighandler; sigaction(SIGTERM, &handler, 0); sigaction(SIGINT, &handler, 0); From e6338e9f9e117587a52ceb8675eb4c4689e05503 Mon Sep 17 00:00:00 2001 From: Chris Spiegel Date: Sat, 31 Jan 2015 23:05:27 -0800 Subject: [PATCH 2/2] Fix parenthesis placement inside of unlikely(). --- lrzip.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lrzip.c b/lrzip.c index 3e03a6e..0bdb98a 100644 --- a/lrzip.c +++ b/lrzip.c @@ -965,7 +965,7 @@ next_chunk: while (stream < NUM_STREAMS) { int block = 1; - if (unlikely(lseek(fd_in, stream_head[stream] + ofs, SEEK_SET)) == -1) + if (unlikely(lseek(fd_in, stream_head[stream] + ofs, SEEK_SET) == -1)) fatal_goto(("Failed to seek to header data in get_fileinfo\n"), error); if (unlikely(!get_header_info(control, fd_in, &ctype, &c_len, &u_len, &last_head, chunk_byte))) return false; @@ -978,7 +978,7 @@ next_chunk: if (unlikely(last_head + ofs > infile_size)) failure_goto(("Offset greater than archive size, likely corrupted/truncated archive.\n"), error); - if (unlikely(head_off = lseek(fd_in, last_head + ofs, SEEK_SET)) == -1) + if (unlikely(head_off = lseek(fd_in, last_head + ofs, SEEK_SET) == -1)) fatal_goto(("Failed to seek to header data in get_fileinfo\n"), error); if (unlikely(!get_header_info(control, fd_in, &ctype, &c_len, &u_len, &last_head, chunk_byte))) @@ -1074,7 +1074,7 @@ done: int i; print_output("MD5 used for integrity testing\n"); - if (unlikely(lseek(fd_in, -MD5_DIGEST_SIZE, SEEK_END)) == -1) + if (unlikely(lseek(fd_in, -MD5_DIGEST_SIZE, SEEK_END) == -1)) fatal_goto(("Failed to seek to md5 data in runzip_fd\n"), error); if (unlikely(read(fd_in, md5_stored, MD5_DIGEST_SIZE) != MD5_DIGEST_SIZE)) fatal_goto(("Failed to read md5 data in runzip_fd\n"), error);