dvd-sector-copy.c: Truncate the event list before processing a lost `stop'.
[dvdrip] / dvdrip
diff --git a/dvdrip b/dvdrip
index 8ff1d98..9634fe0 100755 (executable)
--- a/dvdrip
+++ b/dvdrip
@@ -96,6 +96,9 @@ info "copying \`$discid'"
 echo "$discid" >"$tmp/$tag/discid.new"
 mv "$tmp/$tag/discid.new" "$tmp/$tag/discid"
 
+if [ -b "$dev" ]; then msz=$(blockdev --getsize64 "$dev")
+else msz=nil; fi
+
 echo "$dev" >"$tmp/$tag/device.new"
 mv "$tmp/$tag/device.new" "$tmp/$tag/device"
 
@@ -152,6 +155,16 @@ if [ ! -f "$tmp/$tag/iso" ]; then
   if [ -f "$tmp/$tag/badblocks" ]; then
     fail "bad sectors found: check \`$tmp/$tag/iso', run again if ok"
   fi
+  case $msz in
+    nil) ;;
+    *)
+      newmsz=$(blockdev --getsize64 "$dev")
+      case $newmsz in
+       $msz) ;;
+       *) fail "medium size changed ($msz -> $newmsz): try again" ;;
+      esac
+      ;;
+  esac
 fi
 
 rm -f "$tmp/$tag/device"