]> git.pond.sub.org Git - empserver/commitdiff
Fix setsector and setres not to wipe out concurrent updates
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 16 Apr 2011 18:34:26 +0000 (20:34 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 17 Apr 2011 08:47:57 +0000 (10:47 +0200)
setsector() reads the sector, prompts for input, then writes back the
sector, triggering a generation oops.  Any updates made by other
threads while setsector() waits for input are wiped out, triggering a
seqno mismatch oops.

Same for setres().

src/lib/commands/setres.c
src/lib/commands/setsect.c

index df5129f893532e53a9ac150863d3f016ce20337f..80b9bbbcb6dd526a11cc0e7b310bda3bd6a7d555 100644 (file)
@@ -68,6 +68,7 @@ setres(void)
            amt = 100;
        if (amt < 0)
            amt = 0;
+       check_sect_ok(&sect);
        switch (char0) {
        case 'i':
            if (sect.sct_own != 0)
index f157abc9c9cb56753e0e36bc77deb60a22906c91..05397967186f9ad07b52728a3c1f1f54594eda48 100644 (file)
@@ -68,6 +68,7 @@ setsector(void)
        if (!p || !*p)
            return RET_SYN;
        amt = atoi(p);
+       check_sect_ok(&sect);
        switch (char0) {
        case 'i':
            current = sect.sct_min;