{
EC_INIT;
struct vol *volume = NULL;
- char current_path[MAXPATHLEN+1], another_path[MAXPATHLEN+1];
size_t current_pathlen, another_pathlen;
int i, suffixlen, vlen, tmpvlen, u8mvlen, macvlen;
char *tmpname;
}
/* Once volumes are loaded, we never change options again, we just delete em when they're removed from afp.conf */
- /* Duplicated or nested volume is ignored */
- strlcpy(current_path, path, MAXPATHLEN);
- current_pathlen = strlcat(current_path, "/", MAXPATHLEN);
+
+ /* Check for duplicated or nested volumes */
+ current_pathlen = strlen(path);
for (struct vol *vol = Volumes; vol; vol = vol->v_next) {
- strlcpy(another_path, vol->v_path, MAXPATHLEN);
- another_pathlen = strlcat(another_path, "/", MAXPATHLEN);
- if ( 0 == strncmp(current_path, another_path, MIN(current_pathlen, another_pathlen))) {
+ another_pathlen = strlen(vol->v_path);
+ if (strncmp(path, vol->v_path, MIN(current_pathlen, another_pathlen)) == 0) {
if (current_pathlen == another_pathlen) {
- if ( 0 == strcmp(name ,vol->v_localname)) {
+ if ( 0 == strcmp(name, vol->v_localname)) {
LOG(log_debug, logtype_afpd, "createvol('%s'): already loaded", name);
} else {
LOG(log_error, logtype_afpd, "paths are duplicated - \"%s\"", path);