Make assertions about state in negotiation function
authorWouter Verhelst <w@uter.be>
Fri, 23 Dec 2011 17:58:54 +0000 (18:58 +0100)
committerWouter Verhelst <w@uter.be>
Fri, 23 Dec 2011 17:58:54 +0000 (18:58 +0100)
nbd-server.c

index 810673e..0ecf0e8 100644 (file)
@@ -1498,6 +1498,7 @@ CLIENT* negotiate(int net, CLIENT *client, GArray* servers, int phase) {
        uint64_t magic;
 
        memset(zeros, '\0', sizeof(zeros));
+       g_assert(((phase & NEG_INIT) && (phase & NEG_MODERN)) || client);
        if(phase & NEG_INIT) {
                /* common */
                if (write(net, INIT_PASSWD, 8) < 0) {