Matt McCutchen's Web Site
/
rsync
/
rsync.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Clarify the short description of --chmod.
[rsync/rsync.git]
/
util.c
diff --git
a/util.c
b/util.c
index
85b2227
..
72e0859
100644
(file)
--- a/
util.c
+++ b/
util.c
@@
-111,13
+111,13
@@
void print_child_argv(char **cmd)
void out_of_memory(char *str)
{
void out_of_memory(char *str)
{
- rprintf(FERROR, "ERROR: out of memory in %s
\n", str
);
+ rprintf(FERROR, "ERROR: out of memory in %s
[%s]\n", str, who_am_i()
);
exit_cleanup(RERR_MALLOC);
}
void overflow_exit(char *str)
{
exit_cleanup(RERR_MALLOC);
}
void overflow_exit(char *str)
{
- rprintf(FERROR, "ERROR: buffer overflow in %s
\n", str
);
+ rprintf(FERROR, "ERROR: buffer overflow in %s
[%s]\n", str, who_am_i()
);
exit_cleanup(RERR_MALLOC);
}
exit_cleanup(RERR_MALLOC);
}
@@
-922,7
+922,8
@@
void die_on_unsafe_path(char *path, int strip_filename)
if ((p = strchr(p, '/')) != NULL)
*p = '\0';
if (safe_stat(path, &st) < 0) {
if ((p = strchr(p, '/')) != NULL)
*p = '\0';
if (safe_stat(path, &st) < 0) {
- *p++ = '/';
+ if (p)
+ *p = '/';
goto done;
}
if (S_ISLNK(st.st_mode)) {
goto done;
}
if (S_ISLNK(st.st_mode)) {
@@
-943,7
+944,7
@@
void die_on_unsafe_path(char *path, int strip_filename)
/* Like chdir(), but it keeps track of the current directory (in the
* global "curr_dir"), and ensures that the path size doesn't overflow.
* Also cleans the path using the clean_fname() function. */
/* Like chdir(), but it keeps track of the current directory (in the
* global "curr_dir"), and ensures that the path size doesn't overflow.
* Also cleans the path using the clean_fname() function. */
-int push_dir(char *dir)
+int push_dir(char *dir
, int set_path_only
)
{
static int initialised;
unsigned int len;
{
static int initialised;
unsigned int len;
@@
-964,7
+965,7
@@
int push_dir(char *dir)
if ((*dir == '/' ? len : curr_dir_len + 1 + len) >= sizeof curr_dir)
return 0;
if ((*dir == '/' ? len : curr_dir_len + 1 + len) >= sizeof curr_dir)
return 0;
- if (chdir(dir))
+ if (
!set_path_only &&
chdir(dir))
return 0;
if (*dir == '/') {
return 0;
if (*dir == '/') {
@@
-1033,7
+1034,8
@@
char *full_fname(const char *fn)
} else
m1 = m2 = m3 = "";
} else
m1 = m2 = m3 = "";
- asprintf(&result, "\"%s%s%s\"%s%s%s", p1, p2, fn, m1, m2, m3);
+ if (asprintf(&result, "\"%s%s%s\"%s%s%s", p1, p2, fn, m1, m2, m3) <= 0)
+ out_of_memory("full_fname");
return result;
}
return result;
}