]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
mkgnutar.pl: avoid uninitialized username variable
authorusertam <code@usertam.dev>
Thu, 29 May 2025 11:19:06 +0000 (19:19 +0800)
committerusertam <code@usertam.dev>
Thu, 29 May 2025 11:44:43 +0000 (19:44 +0800)
This can happen when the running uid is dynamically allocated
without a proper user entry or name.

tests/m_rootgnutar/mkgnutar.pl

index 516124cdb353d24aefcbb0706fede7681f37cb47..2513b9b72d72eadf15da9e1da6f729d913fafa58 100644 (file)
@@ -59,7 +59,7 @@ foreach my $fname (@entries) {
     my $content = "";
     my $type;
     my $linkname = "";
-    my $username = $ENV{LOGNAME} || $ENV{USER} || getpwuid($<);
+    my $username = $ENV{LOGNAME} || $ENV{USER} || getpwuid($<) || "";
     if (S_ISLNK($mode)) {
         $type     = 2;
         $linkname = readlink $fname;