#endif /* NO_QUOTACTL_USED */
#if defined(HAVE_MNTENT) && defined(HAVE_REALPATH)
-static int sys_path_to_bdev(const char *path, char **mntpath, char **bdev, char **fs)
+static int sys_path_to_bdev(TALLOC_CTX *mem_ctx,
+ const char *path,
+ char **mntpath,
+ char **bdev,
+ char **fs)
{
int ret = -1;
SMB_STRUCT_STAT S;
continue ;
if (S.st_ex_dev == devno) {
- (*mntpath) = SMB_STRDUP(mnt->mnt_dir);
- (*bdev) = SMB_STRDUP(mnt->mnt_fsname);
- (*fs) = SMB_STRDUP(mnt->mnt_type);
+ (*mntpath) = talloc_strdup(mem_ctx, mnt->mnt_dir);
+ (*bdev) = talloc_strdup(mem_ctx, mnt->mnt_fsname);
+ (*fs) = talloc_strdup(mem_ctx, mnt->mnt_type);
if ((*mntpath)&&(*bdev)&&(*fs)) {
ret = 0;
} else {
- SAFE_FREE(*mntpath);
- SAFE_FREE(*bdev);
- SAFE_FREE(*fs);
+ TALLOC_FREE(*mntpath);
+ TALLOC_FREE(*bdev);
+ TALLOC_FREE(*fs);
ret = -1;
}
#elif defined(HAVE_DEVNM)
/* we have this on HPUX, ... */
-static int sys_path_to_bdev(const char *path, char **mntpath, char **bdev, char **fs)
+static int sys_path_to_bdev(TALLOC_CTX *mem_ctx,
+ const char *path,
+ char **mntpath,
+ char **bdev,
+ char **fs)
{
int ret = -1;
char dev_disk[256];
* but I don't know how
* --metze
*/
- (*mntpath) = SMB_STRDUP(path);
- (*bdev) = SMB_STRDUP(dev_disk);
+ (*mntpath) = talloc_strdup(mem_ctx, path);
+ (*bdev) = talloc_strdup(mem_dev_disk);
if ((*mntpath)&&(*bdev)) {
ret = 0;
} else {
- SAFE_FREE(*mntpath);
- SAFE_FREE(*bdev);
+ TALLOC_FREE(*mntpath);
+ TALLOC_FREE(*bdev);
ret = -1;
}
/* #endif HAVE_DEVNM */
#else
/* we should fake this up...*/
-static int sys_path_to_bdev(const char *path, char **mntpath, char **bdev, char **fs)
+static int sys_path_to_bdev(TALLOC_CTX *mem_ctx,
+ const char *path,
+ char **mntpath,
+ char **bdev,
+ char **fs)
{
int ret = -1;
(*bdev) = NULL;
(*fs) = NULL;
- (*mntpath) = SMB_STRDUP(path);
+ (*mntpath) = talloc_strdup(mem_ctx, path);
if (*mntpath) {
ret = 0;
} else {
- SAFE_FREE(*mntpath);
+ TALLOC_FREE(*mntpath);
ret = -1;
}
return -1;
}
- if ((ret=sys_path_to_bdev(path,&mntpath,&bdev,&fs))!=0) {
+ ret = sys_path_to_bdev(talloc_tos(), path, &mntpath, &bdev, &fs);
+ if (ret != 0) {
DEBUG(0,("sys_path_to_bdev() failed for path [%s]!\n",path));
return ret;
}
}
}
- SAFE_FREE(mntpath);
- SAFE_FREE(bdev);
- SAFE_FREE(fs);
+ TALLOC_FREE(mntpath);
+ TALLOC_FREE(bdev);
+ TALLOC_FREE(fs);
return ret;
}
return -1;
}
- if ((ret=sys_path_to_bdev(path,&mntpath,&bdev,&fs))!=0) {
+ ret = sys_path_to_bdev(talloc_tos(), path, &mntpath, &bdev, &fs);
+ if (ret != 0) {
DEBUG(0,("sys_path_to_bdev() failed for path [%s]!\n",path));
return ret;
}
}
}
- SAFE_FREE(mntpath);
- SAFE_FREE(bdev);
- SAFE_FREE(fs);
+ TALLOC_FREE(mntpath);
+ TALLOC_FREE(bdev);
+ TALLOC_FREE(fs);
return ret;
}