Have gedit() and gsetpid() both return CMD_CLEAN if no data has
authorkrw <krw@openbsd.org>
Sun, 13 Jun 2021 15:32:36 +0000 (15:32 +0000)
committerkrw <krw@openbsd.org>
Sun, 13 Jun 2021 15:32:36 +0000 (15:32 +0000)
changed, thus keeping the modified indicator correct and avoiding
early bailout when editing a gpt partition w/o changing the type.

sbin/fdisk/cmd.c

index 8c151c6..e0627d2 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: cmd.c,v 1.113 2021/06/13 14:39:05 krw Exp $   */
+/*     $OpenBSD: cmd.c,v 1.114 2021/06/13 15:32:36 krw Exp $   */
 
 /*
  * Copyright (c) 1997 Tobias Weingartner
@@ -197,6 +197,8 @@ gedit(int pn)
 
        if (memcmp(gg, &oldgg, sizeof(*gg)))
                return (CMD_DIRTY);
+       else
+               return (CMD_CLEAN);
 
  done:
        *gg = oldgg;
@@ -329,6 +331,8 @@ gsetpid(int pn)
 
        if (memcmp(gg, &oldgg, sizeof(*gg)))
                return (CMD_DIRTY);
+       else
+               return (CMD_CLEAN);
 
  done:
        *gg = oldgg;