aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2014-04-09 17:26:10 +0300
committerLasse Collin <lasse.collin@tukaani.org>2014-04-09 17:26:10 +0300
commit54df428799a8d853639b753d0e6784694d73eb3e (patch)
tree911aef1d43fa1440af16e6ac1b811cfef12d3871
parentDocs: Add example program for threaded encoding. (diff)
downloadxz-54df428799a8d853639b753d0e6784694d73eb3e.tar.xz
xz: Rename a variable to avoid a namespace collision on Solaris.
I don't know the details but I have an impression that there's no problem in practice if using GCC since people have built xz with GCC (without patching xz), but renaming the variable cannot hurt either. Thanks to Mark Ashley.
-rw-r--r--src/xz/signals.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/xz/signals.c b/src/xz/signals.c
index 2a1d4eb7..5387c424 100644
--- a/src/xz/signals.c
+++ b/src/xz/signals.c
@@ -82,17 +82,19 @@ signals_init(void)
sigaddset(&hooked_signals, message_progress_sigs[i]);
#endif
- struct sigaction sa;
+ // Using "my_sa" because "sa" may conflict with a sockaddr variable
+ // from system headers on Solaris.
+ struct sigaction my_sa;
// All the signals that we handle we also blocked while the signal
// handler runs.
- sa.sa_mask = hooked_signals;
+ my_sa.sa_mask = hooked_signals;
// Don't set SA_RESTART, because we want EINTR so that we can check
// for user_abort and cleanup before exiting. We block the signals
// for which we have established a handler when we don't want EINTR.
- sa.sa_flags = 0;
- sa.sa_handler = &signal_handler;
+ my_sa.sa_flags = 0;
+ my_sa.sa_handler = &signal_handler;
for (size_t i = 0; i < ARRAY_SIZE(sigs); ++i) {
// If the parent process has left some signals ignored,
@@ -103,7 +105,7 @@ signals_init(void)
continue;
// Establish the signal handler.
- if (sigaction(sigs[i], &sa, NULL))
+ if (sigaction(sigs[i], &my_sa, NULL))
message_signal_handler();
}