Fix swapsector not to wipe out concurrent updates.
authorMarkus Armbruster <armbru@pond.sub.org>
Mon, 9 Mar 2009 21:31:49 +0000 (22:31 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Mon, 9 Mar 2009 21:32:10 +0000 (22:32 +0100)
Make swaps() bail out if any of the sectors changed while edit() slept
for input.

src/lib/commands/swap.c

index e8c9d854e9c61e4004b0a82699e4963c86c59cac..d7c75f5fb7be5a28a67b801cbd5340bf0048b61a 100644 (file)
@@ -59,6 +59,8 @@ swaps(void)
     print_res(&sectb);
     if (!confirm ("Are you sure these are the two sectors you wish to swap? "))
        return RET_FAIL;
+    if (!check_sect_ok(&secta) || !check_sect_ok(&sectb))
+       return RET_FAIL;
     tmp = secta;
     /* change the location of secta to that of sectb */
     secta.sct_x = sectb.sct_x;