Original debian patch as of 1.3.8-9.

--- slice-1.3.8.orig/Makefile.in
+++ slice-1.3.8/Makefile.in
@@ -28,7 +28,7 @@
 bindir          = $(prefix)/bin
 libsubdir       = @libsubdir@
 libdir          = $(prefix)/lib$(libsubdir)
-mandir          = $(prefix)/man
+mandir          = @mandir@
 
 PATH_PERL       = @PATH_PERL@
 INSTALLPRIVLIB  = @INSTALLPRIVLIB@
--- slice-1.3.8.orig/slice_setup.pl
+++ slice-1.3.8/slice_setup.pl
@@ -75,17 +75,21 @@
     #   read input file
     if (($#ARGV == 0 and $ARGV[0] eq '-') or $#ARGV == -1) {
         $fp = new IO::Handle;
-        $fp->fdopen(fileno(STDIN), "r");
+        $fp->fdopen(fileno(STDIN), "r")
+            || error("Unable to load STDIN: $!\n");
         local ($/) = undef;
         $INPUT = <$fp>;
-        $fp->close;
+        $fp->close()
+            || error("Unable to close STDIN: $!\n");
     }
     elsif ($#ARGV == 0) {
         $fp = new IO::File;
-        $fp->open($ARGV[0]);
+        $fp->open($ARGV[0])
+            || error("Unable to load $ARGV[0]: $!\n");
         local ($/) = undef;
         $INPUT = <$fp>;
-        $fp->close;
+        $fp->close()
+            || error("Unable to close $ARGV[0]: $!\n");
     }
     else {
         usage();
--- slice-1.3.8.orig/slice_util.pl
+++ slice-1.3.8/slice_util.pl
@@ -29,6 +29,15 @@
     exit(1);
 }
 
+sub fileerror {
+    my $file  = shift;
+    my ($str) = @_;
+
+    printerror($str);
+    unlink $file;
+    exit(1);
+}
+
 sub printwarning {
     my ($str) = @_;
 
--- slice-1.3.8.orig/slice_pass3.pl
+++ slice-1.3.8/slice_pass3.pl
@@ -92,21 +92,32 @@
         #   skip file if requested by options
         if ($status->{z} > 0 and $out eq '') {
                 printwarning("Empty output: skip generation of $outfile\n");
-                next if $status->{z} > 1;
+                main::error("Execution stopped\n") if $status->{z} > 2;
+                next if $status->{z} == 2;
         }
         if ($status->{s} > 0 and ($out eq '' or $out !~ m/\S/)) {
                 printwarning("Whitespace only: skip generation of $outfile\n");
-                next if $status->{s} > 1;
+                main::error("Execution stopped\n") if $status->{s} > 2;
+                next if $status->{s} == 2;
         }
 
         #   open output file
         if ($outfile eq '-') {
-            print $out;
+            $fp = new IO::Handle;
+            $fp->fdopen(fileno(STDOUT), "w")
+                or main::error("Unable to write into STDOUT: $!\n");
+            print $fp $out;
+            $fp->close()
+                or main::error("Unable to close STDOUT: $!\n");
         }
         else {
-            open(OUT, ">$outfile");
-            print OUT $out;
-            close(OUT);
+            $fp = new IO::File;
+            $fp->open("> $outfile")
+                or main::error("Unable to write into $outfile: $!\n");
+            print $fp $out
+                or main::fileerror($outfile, "Unable to write into $outfile: $!\n");
+            $fp->close()
+                or main::fileerror($outfile, "Unable to close $outfile: $!\n");
         }
 
         #   additionally run chmod on the output file
