Fix command-line oldstyle export
authorWouter Verhelst <w@uter.be>
Thu, 5 Aug 2010 23:47:19 +0000 (19:47 -0400)
committerWouter Verhelst <w@uter.be>
Thu, 5 Aug 2010 23:47:19 +0000 (19:47 -0400)
nbd-server.c

index 11fa5d7..7e97e45 100644 (file)
@@ -515,6 +515,8 @@ SERVER* cmdline(int argc, char *argv[]) {
        if(nonspecial<2) {
                g_free(serve);
                serve=NULL;
+       } else {
+               do_oldstyle = TRUE;
        }
        if(do_output) {
                if(!serve) {
@@ -1231,7 +1233,11 @@ CLIENT* negotiate(int net, CLIENT *client, GArray* servers) {
                        if(client)
                                exit(EXIT_FAILURE);
                }
-               magic = htonll(opts_magic);
+               if(client && client->modern) {
+                       magic = htonll(opts_magic);
+               } else {
+                       magic = htonll(cliserv_magic);
+               }
                if (write(net, &magic, sizeof(magic)) < 0) {
                        err_nonfatal("Negotiation failed: %m");
                        if(client)