Skip to content

Commit feed472

Browse files
author
Ralph Castain
authored
Merge pull request #3043 from rhc54/topic/purge
Skip empty files to avoid infinite loop
2 parents af0b5cf + a774ea7 commit feed472

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

contrib/purge-trailing-blank-lines.pl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ sub quiet_print {
7272
# Examine each of the files and remove trailing blank lines
7373
foreach my $f (@files) {
7474
quiet_print "==> Working file: $f\n";
75+
# check file size
76+
my $filesize = -s $f;
77+
if (0 == $filesize) {
78+
next;
79+
}
80+
7581
open $fh, "+<$f" or die "$!";
7682

7783
binmode $fh; # Just in case

0 commit comments

Comments
 (0)