* Copyright (C) 1996-2001 Andrew Tridgell <tridge@samba.org>
* Copyright (C) 1996 Paul Mackerras
* Copyright (C) 2002 Martin Pool
- * Copyright (C) 2003-2008 Wayne Davison
+ * Copyright (C) 2003-2009 Wayne Davison
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/* If the name isn't in buf yet, it's wasn't absolute. */
if (fn != buf) {
- if (dirbuf_len + fn_len >= MAXPATHLEN) {
+ int d_len = dirbuf_len - prefix_skip;
+ if (d_len + fn_len >= MAXPATHLEN) {
rprintf(FERROR, "merge-file name overflows: %s\n", fn);
return NULL;
}
- memcpy(buf, dirbuf + prefix_skip, dirbuf_len - prefix_skip);
- memcpy(buf + dirbuf_len - prefix_skip, fn, fn_len + 1);
+ memcpy(buf, dirbuf + prefix_skip, d_len);
+ memcpy(buf + d_len, fn, fn_len + 1);
fn_len = clean_fname(buf, CFN_COLLAPSE_DOT_DOT_DIRS);
}
XFLG_ANCHORED2ABS);
} else {
io_error |= IOERR_GENERAL;
- rprintf(FINFO,
+ rprintf(FERROR,
"cannot add local filter rules in long-named directory: %s\n",
full_fname(dirbuf));
}