]> git.ipfire.org Git - thirdparty/xz.git/commitdiff
xz: Rename a variable to avoid a namespace collision on Solaris.
authorLasse Collin <lasse.collin@tukaani.org>
Wed, 9 Apr 2014 14:26:10 +0000 (17:26 +0300)
committerLasse Collin <lasse.collin@tukaani.org>
Sat, 26 Apr 2014 05:47:24 +0000 (08:47 +0300)
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.

src/xz/signals.c

index de213644d00b2365bfbb1a79c08d29d3a3e32de5..322811f472b5a0ab4040f617128c5149a70a4a6c 100644 (file)
@@ -77,17 +77,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,
@@ -98,7 +100,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();
        }