mirror of
https://git.openafs.org/openafs.git
synced 2025-01-21 00:10:15 +00:00
vol: avoid double dir separators from addtoname
The manner in which addtoname() is used can often result in double dir separators in path names. Check for it and avoid doubling the separator in addtoname() Change-Id: Ie33459bec3bcc93f81f13020cd35ed8c473b6ca5 Reviewed-on: http://gerrit.openafs.org/3699 Reviewed-by: Derrick Brashear <shadow@dementia.org> Reviewed-by: Andrew Deason <adeason@sinenomine.net> Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com> Tested-by: BuildBot <buildbot@rampaginggeek.com>
This commit is contained in:
parent
9e689e9609
commit
959a892afc
@ -248,17 +248,18 @@ namei_HandleToInodeDir(namei_t * name, IHandle_t * ih)
|
||||
*/
|
||||
volutil_PartitionName_r(ih->ih_dev, name->n_base, sizeof(name->n_base));
|
||||
offset = VICE_PREFIX_SIZE + (ih->ih_dev > 25 ? 2 : 1);
|
||||
name->n_base[offset] = '/';
|
||||
name->n_base[offset] = OS_DIRSEPC;
|
||||
offset++;
|
||||
strlcpy(name->n_base + offset, INODEDIR, sizeof(name->n_base) - offset);
|
||||
strlcpy(name->n_path, name->n_base, sizeof(name->n_path));
|
||||
}
|
||||
#endif
|
||||
|
||||
#define addtoname(N, C) \
|
||||
do { \
|
||||
strlcat((N)->n_path, OS_DIRSEP, sizeof((N)->n_path)); \
|
||||
strlcat((N)->n_path, (C), sizeof((N)->n_path)); \
|
||||
#define addtoname(N, C) \
|
||||
do { \
|
||||
if ((N)->n_path[strlen((N)->n_path)-1] != OS_DIRSEPC) \
|
||||
strlcat((N)->n_path, OS_DIRSEP, sizeof((N)->n_path)); \
|
||||
strlcat((N)->n_path, (C), sizeof((N)->n_path)); \
|
||||
} while(0)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user