From: Ben Pfaff Date: Tue, 14 Dec 2004 01:33:44 +0000 (+0000) Subject: Fix zero-length file case on put. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=28166ea5b3ebbea39e2b96d6f645ce5d4790e8e2;p=pintos-anon Fix zero-length file case on put. --- 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");