cast the pointer to char * for all calls to bzero
[deb_libnfs.git] / lib / init.c
index dde97d773062d8438e7c3c972a821740f275949d..d83e3ed9a6ccd32452000785d9d2de14725284c9 100644 (file)
@@ -35,22 +35,19 @@ struct rpc_context *rpc_init_context(void)
 
        rpc = malloc(sizeof(struct rpc_context));
        if (rpc == NULL) {
-               printf("Failed to allocate rpc context\n");
                return NULL;
        }
-       bzero(rpc, sizeof(struct rpc_context));
+       bzero((char *)rpc, sizeof(struct rpc_context));
 
        rpc->encodebuflen = 65536;
        rpc->encodebuf = malloc(rpc->encodebuflen);
        if (rpc->encodebuf == NULL) {
-               printf("Failed to allocate a buffer for rpc encoding\n");
                free(rpc);
                return NULL;
        }
 
        rpc->auth = authunix_create_default();
        if (rpc->auth == NULL) {
-               printf("failed to create authunix\n");
                free(rpc->encodebuf);
                free(rpc);
                return NULL;
@@ -62,6 +59,18 @@ struct rpc_context *rpc_init_context(void)
 }
 
 
+struct rpc_context *rpc_init_udp_context(void)
+{
+       struct rpc_context *rpc;
+
+       rpc = rpc_init_context();
+       if (rpc != NULL) {
+               rpc->is_udp = 1;
+       }
+       
+       return rpc;
+}
+
 void rpc_set_auth(struct rpc_context *rpc, struct AUTH *auth)
 {
        if (rpc->auth != NULL) {
@@ -139,6 +148,11 @@ void rpc_destroy_context(struct rpc_context *rpc)
                rpc->error_string = NULL;
        }
 
+       if (rpc->udp_dest != NULL) {
+               free(rpc->udp_dest);
+               rpc->udp_dest = NULL;
+       }
+
        free(rpc);
 }