Matt McCutchen's Web Site
/
rsync
/
rsync.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
813d5a2
)
Avoid adding a slash to path '/'.
author
Wayne Davison
<wayned@samba.org>
Fri, 22 Apr 2011 22:51:55 +0000
(15:51 -0700)
committer
Wayne Davison
<wayned@samba.org>
Fri, 22 Apr 2011 23:06:15 +0000
(16:06 -0700)
util.c
patch
|
blob
|
blame
|
history
diff --git
a/util.c
b/util.c
index
3f611d1
..
5200a9a
100644
(file)
--- a/
util.c
+++ b/
util.c
@@
-1062,8
+1062,9
@@
int change_dir(const char *dir, int set_path_only)
errno = ENAMETOOLONG;
return 0;
}
errno = ENAMETOOLONG;
return 0;
}
- curr_dir[curr_dir_len] = '/';
- memcpy(curr_dir + curr_dir_len + 1, dir, len + 1);
+ if (!(curr_dir_len && curr_dir[curr_dir_len-1] == '/'))
+ curr_dir[curr_dir_len++] = '/';
+ memcpy(curr_dir + curr_dir_len, dir, len + 1);
if (!set_path_only && chdir(curr_dir)) {
curr_dir[curr_dir_len] = '\0';
if (!set_path_only && chdir(curr_dir)) {
curr_dir[curr_dir_len] = '\0';