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=c0bc07e2f62859beddbb97bfa19005d07820fd0a;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");