+ return $exists && $origSize > 0;
+}
+
+#
+# Generate a log file message for a completed file
+#
+sub logFileAction
+{
+ my($action, $f) = @_;
+ my $owner = "$f->{uid}/$f->{gid}";
+ my $name = $f->{name};
+ $name = "." if ( $name eq "" );
+ my $type = (("", "p", "c", "", "d", "", "b", "", "", "", "l", "", "s"))
+ [($f->{mode} & S_IFMT) >> 12];
+ $type = "h" if ( $f->{type} == BPC_FTYPE_HARDLINK );
+
+ printf(" %-6s %1s%4o %9s %11.0f %s\n",
+ $action,
+ $type,
+ $f->{mode} & 07777,
+ $owner,
+ $f->{size},
+ $name);
+}
+
+#
+# Create the parent directory of $file if necessary
+#
+sub pathCreate
+{
+ my($dir, $fullPath, $f) = @_;
+
+ #
+ # Get parent directory of each of $dir and $fullPath
+ #
+ # print("pathCreate: dir = $dir, fullPath = $fullPath\n");
+ $dir =~ s{/([^/]*)$}{};
+ my $file = $bpc->fileNameUnmangle($1);
+ $fullPath =~ s{/[^/]*$}{};
+ return if ( -d $fullPath || $file eq "" );
+ unlink($fullPath) if ( -e $fullPath );
+ mkpath($fullPath, 0, 0777);
+ $Attrib{$dir} = BackupPC::Attrib->new({ compress => $Compress })
+ if ( !defined($Attrib{$dir}) );
+ # print("pathCreate: adding file = $file to dir = $dir\n");
+ $Attrib{$dir}->set($file, {
+ type => BPC_FTYPE_DIR,
+ mode => 0755,
+ uid => $f->{uid},
+ gid => $f->{gid},
+ size => 0,
+ mtime => 0,
+ });
+}
+
+sub catch_signal
+{
+ my $sigName = shift;
+
+ #
+ # The first time we receive a signal we try to gracefully
+ # abort the backup. This allows us to keep a partial dump
+ # with the in-progress file deleted and attribute caches
+ # flushed to disk etc.
+ #
+ print("BackupPC_tarExtract: got signal $sigName\n");
+ if ( !$Abort ) {
+ $Abort++;
+ $AbortReason = "received signal $sigName";
+ return;
+ }
+
+ #
+ # This is a second signal: time to clean up.
+ #
+ print("BackupPC_tarExtract: quitting on second signal $sigName\n");
+ close(NEW_FILES);
+ exit(1)