commit:     b156541b302bbca42e2bbda074cace7109c7cacf
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Fri Jan  9 03:08:13 2026 +0000
Commit:     Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Fri Jan  9 03:08:13 2026 +0000
URL:        https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=b156541b

Report SELinux label support immediately upon detection

Doing so makes no difference in practice, but the code flows a little
more nicely.

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

 locale-gen | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/locale-gen b/locale-gen
index ed5edbb..9260240 100644
--- a/locale-gen
+++ b/locale-gen
@@ -574,7 +574,11 @@ sub generate_archive ($gentoo_prefix, $locale_dir, 
$prior_archive, @names) {
 
 sub install_archive ($src_path, $dst_path, $may_reset_labels) {
        # Determine whether the underlying filesystem supports SELinux labels.
-       my $has_seclabels = has_mount_option(dirname($dst_path), 'seclabel');
+       my $has_seclabels;
+       if (has_mount_option(dirname($dst_path), 'seclabel')) {
+               print "The filesystem is mounted with support for SELinux 
security labels.\n";
+               $has_seclabels = 1;
+       }
 
        # Determine whether a previously installed archive exists.
        my $has_archive = $has_seclabels && -e $dst_path;
@@ -588,9 +592,6 @@ sub install_archive ($src_path, $dst_path, 
$may_reset_labels) {
        run('mv', '--', $src_path, $interim_path);
 
        # If a prior archive exists, attempt to preserve its SELinux label.
-       if ($has_seclabels) {
-               print "The filesystem is mounted with support for SELinux 
security labels.\n";
-       }
        if ($has_seclabels && $has_archive) {
                my $action = 'copying the security context of the previous 
archive';
                if (can_run('chcon')) {

Reply via email to