From 28166ea5b3ebbea39e2b96d6f645ce5d4790e8e2 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 14 Dec 2004 01:33:44 +0000 Subject: [PATCH] Fix zero-length file case on put. --- src/utils/pintos | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/utils/pintos b/src/utils/pintos index 1242698..a3c9c4c 100755 --- a/src/utils/pintos +++ b/src/utils/pintos @@ -110,7 +110,13 @@ if ($cmd eq 'run') { # Create scratch disk from file. die "$hostfn: $!\n" if ! -e $hostfn; my ($size) = -s _; - copy_pad ($hostfn, "scratch.dsk", 512); + if ($size) { + copy_pad ($hostfn, "scratch.dsk", 512); + } else { + open (SCRATCH, ">scratch.dsk") or die "scratch.dsk: create: $!\n"; + syswrite (SCRATCH, "\0" x 512); + close (SCRATCH); + } # Do copy. my (@cmd) = ("-ci", $guestfn, $size, "-q"); -- 2.30.2