summaryrefslogtreecommitdiff
path: root/examples/VFS/recycle.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2002-05-11 00:33:51 +0000
committerJeremy Allison <jra@samba.org>2002-05-11 00:33:51 +0000
commit3ca09d432c1ec65944da279b7851b960dd564870 (patch)
tree52afac8e9ceed12b2022e914ee15126f8bf474de /examples/VFS/recycle.c
parent9fb0a7cbfc0a725ab31f159d2e23371a4578532d (diff)
downloadsamba-3ca09d432c1ec65944da279b7851b960dd564870.tar.gz
samba-3ca09d432c1ec65944da279b7851b960dd564870.tar.bz2
samba-3ca09d432c1ec65944da279b7851b960dd564870.zip
Fixes for recycle bin VFS for FreeBSD from "Scot W. Hetzel" <hetzels@westbend.net>.
Jeremy (This used to be commit 68b83335de0215314c2234aa83069d8fb8265b80)
Diffstat (limited to 'examples/VFS/recycle.c')
-rw-r--r--examples/VFS/recycle.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/examples/VFS/recycle.c b/examples/VFS/recycle.c
index 74d3657895..6a1c98ce54 100644
--- a/examples/VFS/recycle.c
+++ b/examples/VFS/recycle.c
@@ -238,15 +238,18 @@ static int recycle_unlink(connection_struct *conn, const char *inname)
return default_vfs_ops.unlink(conn,fname);
}
- base = strrchr(fname, '/') + 1;
- if(base == (char*)1)
- ext = strrchr(fname, '.');
- else
- ext = strrchr(base, '.');
-
+ base = strrchr(fname, '/');
pstrcpy(bin, recycle_bin);
pstrcat(bin, "/");
- pstrcat(bin, base);
+
+ if(base == NULL) {
+ ext = strrchr(fname, '.');
+ pstrcat(bin, fname);
+ } else {
+ ext = strrchr(base, '.');
+ pstrcat(bin, base+1);
+ }
+ DEBUG(3, ("recycle bin: base %s, ext %s, fname %s, bin %s\n", base, ext, fname, bin));
if(strcmp(fname,bin) == 0) {
DEBUG(3, ("recycle bin: file %s exists, purging...\n", fname));
@@ -254,6 +257,9 @@ static int recycle_unlink(connection_struct *conn, const char *inname)
}
len = strlen(bin);
+ if ( ext != NULL)
+ len = len - strlen(ext);
+
addlen = sizeof(pstring)-len-1;
while(recycle_file_exist(conn,bin)) {
slprintf(bin+len, addlen, " (Copy #%d)", i++);