diff options
Diffstat (limited to 'examples/VFS/recycle.c')
-rw-r--r-- | examples/VFS/recycle.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/examples/VFS/recycle.c b/examples/VFS/recycle.c index 6a1c98ce54..74d3657895 100644 --- a/examples/VFS/recycle.c +++ b/examples/VFS/recycle.c @@ -238,18 +238,15 @@ static int recycle_unlink(connection_struct *conn, const char *inname) return default_vfs_ops.unlink(conn,fname); } - base = strrchr(fname, '/'); - pstrcpy(bin, recycle_bin); - pstrcat(bin, "/"); - - if(base == NULL) { + base = strrchr(fname, '/') + 1; + if(base == (char*)1) ext = strrchr(fname, '.'); - pstrcat(bin, fname); - } else { + 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)); + + pstrcpy(bin, recycle_bin); + pstrcat(bin, "/"); + pstrcat(bin, base); if(strcmp(fname,bin) == 0) { DEBUG(3, ("recycle bin: file %s exists, purging...\n", fname)); @@ -257,9 +254,6 @@ 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++); |