Make sure x_fdup compiles on Samba 4.
authorJelmer Vernooij <jelmer@samba.org>
Sat, 11 Oct 2008 20:23:07 +0000 (22:23 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Sat, 11 Oct 2008 20:23:07 +0000 (22:23 +0200)
lib/util/xfile.c
lib/util/xfile.h

index b758b1fa9fe391ec1c0c40b8bed73a3dcc7577a8..7cfb68018e95ef6b858079acbf56034fa1eee95f 100644 (file)
@@ -405,11 +405,12 @@ XFILE *x_fdup(const XFILE *f)
                return NULL;
        }
 
-       ret = SMB_CALLOC_ARRAY(XFILE, 1);
+       ret = malloc_p(XFILE);
        if (!ret) {
                close(fd);
                return NULL;
        }
+       memset(ret, 0, sizeof(XFILE));
 
        ret->fd = fd;
        ret->open_flags = f->open_flags;
index 2cc369d8d8efd749decb06530939fea97dd5c496..aa14b7c30a56d78c5a1f0de0822071aab5d29de1 100644 (file)
@@ -62,7 +62,7 @@ int x_fclose(XFILE *f);
 size_t x_fwrite(const void *p, size_t size, size_t nmemb, XFILE *f);
 
 /** thank goodness for asprintf() */
-int x_fileno(XFILE *f);
+int x_fileno(const XFILE *f);
 
 /** simulate fflush() */
 int x_fflush(XFILE *f);