summaryrefslogtreecommitdiffstats
path: root/source3/modules/vfs_recycle.c
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2003-04-09 17:36:52 +0000
committerSimo Sorce <idra@samba.org>2003-04-09 17:36:52 +0000
commitce51825c4bb296622587b1c8ef635aa89fdf4537 (patch)
tree602ed285607eae62c3d61b8400461cca504d85da /source3/modules/vfs_recycle.c
parent7238bf5f40e16360439e028fa7607a5a28e02965 (diff)
downloadsamba-ce51825c4bb296622587b1c8ef635aa89fdf4537.tar.gz
samba-ce51825c4bb296622587b1c8ef635aa89fdf4537.tar.xz
samba-ce51825c4bb296622587b1c8ef635aa89fdf4537.zip
port HEAD mods
(This used to be commit 646eb2dda66d1f619f165076edfc82cd7144ba5a)
Diffstat (limited to 'source3/modules/vfs_recycle.c')
-rw-r--r--source3/modules/vfs_recycle.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/source3/modules/vfs_recycle.c b/source3/modules/vfs_recycle.c
index 823fab2b866..fd4675cb963 100644
--- a/source3/modules/vfs_recycle.c
+++ b/source3/modules/vfs_recycle.c
@@ -461,16 +461,16 @@ static int recycle_unlink(connection_struct *conn, const char *inname)
*/
/* extract filename and path */
- path_name = (char *)malloc(PATH_MAX);
- ALLOC_CHECK(path_name, done);
- safe_strcpy(path_name, file_name, PATH_MAX - 1);
- base = strrchr(path_name, '/');
+ base = strrchr(file_name, '/');
if (base == NULL) {
base = file_name;
- safe_strcpy(path_name, "/", PATH_MAX - 1);
+ path_name = strdup("/");
+ ALLOC_CHECK(path_name, done);
}
else {
- *base = '\0';
+ path_name = strdup(file_name);
+ ALLOC_CHECK(path_name, done);
+ path_name[base - file_name] = '\0';
base++;
}
@@ -494,15 +494,13 @@ static int recycle_unlink(connection_struct *conn, const char *inname)
goto done;
}
- temp_name = (char *)malloc(PATH_MAX);
- ALLOC_CHECK(temp_name, done);
- safe_strcpy(temp_name, recbin->repository, PATH_MAX -1 );
-
/* see if we need to recreate the original directory structure in the recycle bin */
if (recbin->keep_dir_tree == True) {
- safe_strcat(temp_name, "/", PATH_MAX -1 );
- safe_strcat(temp_name, path_name, PATH_MAX - 1);
+ asprintf(&temp_name, "%s/%s", recbin->repository, path_name);
+ } else {
+ temp_name = strdup(recbin->repository);
}
+ ALLOC_CHECK(temp_name, done);
exist = recycle_directory_exist(conn, temp_name);
if (exist) {