commit:     77302f5b63edce9ffbf6853bcdb9cb255ff258df
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Tue Aug 12 05:02:07 2025 +0000
Commit:     Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Tue Aug 12 05:04:45 2025 +0000
URL:        https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=77302f5b

Use ($CHILD_ERROR & 0x7F) to check for death by signal

Should a child process die to a signal, the lower 7 bits of the $?
variable shall contain the signal number, whereas the 8th bit shall
indicate whether a core dump was produced. Hence, either of ($? & 0xFF)
and ($? & 0x7F) can be used to determine whether a process exited
normally. The latter expression is idiomatic, however.

Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>

 locale-gen | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/locale-gen b/locale-gen
index baa520f..fda1830 100755
--- a/locale-gen
+++ b/locale-gen
@@ -127,7 +127,7 @@ sub get_locale_dir () {
        my $stdout = qx{ LC_ALL=C localedef --help 2>/dev/null };
        if ($? == 0 && $stdout =~ m/\hlocale path\h*:\s+(\/[^:]+)/) {
                return canonpath($1);
-       } elsif (($? & 0xFF) == 0) {
+       } elsif (($? & 0x7F) == 0) {
                # The child terminated normally (in the sense of WIFEXITED).
                return undef;
        } else {

Reply via email to