Sync API: Once the sync nfs_mount() functions is finished we have to clear rpc->conne...
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Sun, 9 Oct 2011 08:10:18 +0000 (19:10 +1100)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Sun, 9 Oct 2011 08:10:18 +0000 (19:10 +1100)
Otherwise we get a crash once the connect_cb callback is invoked the second time.

lib/libnfs-sync.c

index 0340edaabbc728f5d271132f9cc75581bfd3c1dd..bd6048eb2751233cf3f66e4f105ec39333a091cb 100644 (file)
@@ -132,6 +132,7 @@ static void mount_cb(int status, struct nfs_context *nfs, void *data, void *priv
 int nfs_mount(struct nfs_context *nfs, const char *server, const char *export)
 {
        struct sync_cb_data cb_data;
+       struct rpc_context *rpc = nfs_get_rpc_context(nfs);
 
        cb_data.is_finished = 0;
 
@@ -142,6 +143,9 @@ int nfs_mount(struct nfs_context *nfs, const char *server, const char *export)
 
        wait_for_nfs_reply(nfs, &cb_data);
 
+       /* Dont want any more callbacks even if the socket is closed */
+       rpc->connect_cb = NULL;
+
        return cb_data.status;
 }