Skip to content

Commit

Permalink
Fix Perl loop reading a list of file names from the command line
Browse files Browse the repository at this point in the history
  while (<>) { ... }

opens all the file names given on the command line in succession, and executes
the loop body once for every line read from those files.  So the existing loop
processed each file over and over N times, where N is the number of lines in
that file.  This appears to have been broken ever since the code's introduction
in be63ae6 "INTEGRATION: CWS networker3
(1.1.2); FILE ADDED: 2004/05/20 11:38:58 obr 1.1.2.1: #i20355#,#i20356# new
directories for system wide desktop integration".

Change-Id: I8b4f0c6812bf3ba42da4b7c55c38e52c91dd4229
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91558
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <[email protected]>
  • Loading branch information
stbergmann committed Apr 2, 2020
1 parent 262fae7 commit 54df1aa
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions sysui/desktop/share/brand.pl
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@
}


while (<>) {
unless (open INFILE,$ARGV) {
print STDOUT "Can't open input file $ARGV: $!\n";
while ($arg = shift) {
unless (open INFILE,$arg) {
print STDOUT "Can't open input file $arg: $!\n";
exit 1;
}

$srcfile = substr($ARGV, rindex($ARGV, "/") + 1);
$srcfile = substr($arg, rindex($arg, "/") + 1);

unless (open OUTFILE,"> $destdir/$prefix$srcfile") {
print STDOUT "Can't open output file $destdir/$prefix$srcfile: $!\n";
Expand Down

0 comments on commit 54df1aa

Please sign in to comment.