Jeremy.
/*
* Macros to help make life easy
*/
-#define COPY_STRING(s) (s) ? strdup(s) : NULL
+#define COPY_STRING(s) (s) ? SMB_STRDUP(s) : NULL
/*******************************************************************
PAM error handler.
continue ;
if (S.st_dev == devno) {
- (*mntpath) = strdup(mnt->mnt_dir);
- (*bdev) = strdup(mnt->mnt_fsname);
- (*fs) = strdup(mnt->mnt_type);
+ (*mntpath) = SMB_STRDUP(mnt->mnt_dir);
+ (*bdev) = SMB_STRDUP(mnt->mnt_fsname);
+ (*fs) = SMB_STRDUP(mnt->mnt_type);
if ((*mntpath)&&(*bdev)&&(*fs)) {
ret = 0;
} else {
* but I don't know how
* --metze
*/
- (*mntpath) = strdup(path);
- (*bdev) = strdup(dev_disk);
+ (*mntpath) = SMB_STRDUP(path);
+ (*bdev) = SMB_STRDUP(dev_disk);
if ((*mntpath)&&(*bdev)) {
ret = 0;
} else {
(*bdev) = NULL;
(*fs) = NULL;
- (*mntpath) = strdup(path);
+ (*mntpath) = SMB_STRDUP(path);
if (*mntpath) {
ret = 0;
} else {
DEBUG(4,(" tconx ok\n"));
- srv = (struct smbw_server *)malloc(sizeof(*srv));
+ srv = SMB_MALLOC_P(struct smbw_server);
if (!srv) {
errno = ENOMEM;
goto failed;
srv->dev = (dev_t)(str_checksum(server) ^ str_checksum(share));
- srv->server_name = strdup(server);
+ srv->server_name = SMB_STRDUP(server);
if (!srv->server_name) {
errno = ENOMEM;
goto failed;
}
- srv->share_name = strdup(share);
+ srv->share_name = SMB_STRDUP(share);
if (!srv->share_name) {
errno = ENOMEM;
goto failed;
}
- srv->workgroup = strdup(workgroup);
+ srv->workgroup = SMB_STRDUP(workgroup);
if (!srv->workgroup) {
errno = ENOMEM;
goto failed;
}
- srv->username = strdup(username);
+ srv->username = SMB_STRDUP(username);
if (!srv->username) {
errno = ENOMEM;
goto failed;
return fd;
}
- file = (struct smbw_file *)malloc(sizeof(*file));
+ file = SMB_MALLOC_P(struct smbw_file);
if (!file) {
errno = ENOMEM;
goto failed;
ZERO_STRUCTP(file);
- file->f = (struct smbw_filedes *)malloc(sizeof(*(file->f)));
+ file->f = SMB_MALLOC_P(struct smbw_filedes);
if (!file->f) {
errno = ENOMEM;
goto failed;
ZERO_STRUCTP(file->f);
file->f->cli_fd = fd;
- file->f->fname = strdup(path);
+ file->f->fname = SMB_STRDUP(path);
if (!file->f->fname) {
errno = ENOMEM;
goto failed;
goto failed;
}
- file2 = (struct smbw_file *)malloc(sizeof(*file2));
+ file2 = SMB_MALLOC_P(struct smbw_file);
if (!file2) {
close(fd2);
errno = ENOMEM;
goto failed;
}
- file2 = (struct smbw_file *)malloc(sizeof(*file2));
+ file2 = SMB_MALLOC_P(struct smbw_file);
if (!file2) {
close(fd2);
errno = ENOMEM;
struct name_list **name_list = (struct name_list **)state;
struct name_list *new_name;
- new_name = (struct name_list *)malloc(sizeof(struct name_list));
+ new_name = SMB_MALLOC_P(struct name_list);
if (!new_name) return;
ZERO_STRUCTP(new_name);
- new_name->name = strdup(name);
+ new_name->name = SMB_STRDUP(name);
new_name->stype = stype;
- new_name->comment = strdup(comment);
+ new_name->comment = SMB_STRDUP(comment);
DLIST_ADD(*name_list, new_name);
}
/* No names cached for this workgroup */
if (names == NULL) {
- new_names = (struct cached_names *)
- malloc(sizeof(struct cached_names));
+ new_names = SMB_MALLOC_P(struct cached_names);
ZERO_STRUCTP(new_names);
DLIST_ADD(cached_names, new_names);
new_names->cache_timeout = now;
new_names->result = result;
- new_names->key = strdup(key);
+ new_names->key = SMB_STRDUP(key);
names = new_names;
}
/* No names cached for this server */
if (names == NULL) {
- new_names = (struct cached_names *)
- malloc(sizeof(struct cached_names));
+ new_names = SMB_MALLOC_P(struct cached_names);
ZERO_STRUCTP(new_names);
DLIST_ADD(cached_names, new_names);
&new_names->name_list);
new_names->cache_timeout = now;
- new_names->key = strdup(key);
+ new_names->key = SMB_STRDUP(key);
names = new_names;
}
}
vfs->files[fd] = (struct files_struct *)malloc(sizeof(struct files_struct));
- vfs->files[fd]->fsp_name = strdup(argv[1]);
+ vfs->files[fd]->fsp_name = SMB_STRDUP(argv[1]);
vfs->files[fd]->fd = fd;
vfs->files[fd]->conn = vfs->conn;
printf("open: fd=%d\n", fd);