vfs: Fix building the glusterfs module.
authorAndreas Schneider <asn@samba.org>
Mon, 4 Nov 2013 11:32:04 +0000 (12:32 +0100)
committerKarolin Seeger <kseeger@samba.org>
Wed, 6 Nov 2013 11:35:12 +0000 (12:35 +0100)
Using calloc directly throws an error. This fixes building the glusterfs
module.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
(cherry picked from commit 25d62dda5c64aefeab0059d9437756f8aaec5397)

source3/modules/vfs_glusterfs.c

index 237236a1df9510fe22bba4b95af8712577380e30..c944276d577656c44c832a210458573b0a4d84ed 100644 (file)
@@ -707,12 +707,12 @@ static char *vfs_gluster_getwd(struct vfs_handle_struct *handle)
        char *cwd;
        char *ret;
 
-       cwd = calloc(1, PATH_MAX + 1);
+       cwd = SMB_CALLOC_ARRAY(char, PATH_MAX);
        if (cwd == NULL) {
                return NULL;
        }
 
-       ret = glfs_getcwd(handle->data, cwd, PATH_MAX);
+       ret = glfs_getcwd(handle->data, cwd, PATH_MAX - 1);
        if (ret == 0) {
                free(cwd);
        }