commit:     6ab521ec91607c47280551344700158745c4b752
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Wed Aug 13 22:40:26 2025 +0000
Commit:     Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Wed Aug 13 22:40:26 2025 +0000
URL:        https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=6ab521ec

Assign TEMPDIR in the main block rather than enter_tempdir()

This makes it more apparent as to how TEMPDIR comes to be populated.

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

 locale-gen | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/locale-gen b/locale-gen
index 766df77..7e313f5 100755
--- a/locale-gen
+++ b/locale-gen
@@ -111,7 +111,7 @@ umask 0022;
        check_archive_dir($prefix, $locale_dir);
 
        # Create a temporary directory and switch to it.
-       enter_tempdir($prefix);
+       $TEMPDIR = enter_tempdir($prefix);
 
        # Compile the selected locales.
        generate_locales($opt{'jobs'}, @locales);
@@ -400,9 +400,11 @@ sub enter_tempdir ($prefix) {
        if (! -d $dir) {
                $dir = File::Spec->tmpdir;
        }
-       $TEMPDIR = tempdir('locale-gen.XXXXXXXXXX', 'DIR' => $dir);
-       if (! chdir $TEMPDIR) {
-               die "$PROGRAM: Can't chdir to '$TEMPDIR': $!\n";
+       my $tmpdir = tempdir('locale-gen.XXXXXXXXXX', 'DIR' => $dir);
+       if (! chdir $tmpdir) {
+               die "$PROGRAM: Can't chdir to '$tmpdir': $!\n";
+       } else {
+               return $tmpdir;
        }
 }
 

Reply via email to