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
Improved the incremental sending of file lists in two ways: (1)
[rsync/rsync.git]
/
clientserver.c
diff --git
a/clientserver.c
b/clientserver.c
index
00c492b
..
fdd19cc
100644
(file)
--- a/
clientserver.c
+++ b/
clientserver.c
@@
-3,12
+3,11
@@
*
* Copyright (C) 1998-2001 Andrew Tridgell <tridge@samba.org>
* Copyright (C) 2001-2002 Martin Pool <mbp@samba.org>
*
* Copyright (C) 1998-2001 Andrew Tridgell <tridge@samba.org>
* Copyright (C) 2001-2002 Martin Pool <mbp@samba.org>
- * Copyright (C) 2002
, 2003, 2004, 2005, 2006
Wayne Davison
+ * Copyright (C) 2002
-2007
Wayne Davison
*
* This program is free software; you can redistribute it and/or modify
*
* 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
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@@
-24,12
+23,14
@@
extern int verbose;
extern int quiet;
extern int verbose;
extern int quiet;
+extern int output_motd;
extern int list_only;
extern int am_sender;
extern int am_server;
extern int am_daemon;
extern int am_root;
extern int rsync_port;
extern int list_only;
extern int am_sender;
extern int am_server;
extern int am_daemon;
extern int am_root;
extern int rsync_port;
+extern int ignore_errors;
extern int kluge_around_eof;
extern int daemon_over_rsh;
extern int sanitize_paths;
extern int kluge_around_eof;
extern int daemon_over_rsh;
extern int sanitize_paths;
@@
-109,7
+110,7
@@
int start_socket_client(char *host, char *path, int argc, char *argv[])
return ret ? ret : client_run(fd, fd, -1, argc, argv);
}
return ret ? ret : client_run(fd, fd, -1, argc, argv);
}
-int start_inband_exchange(char *user, char *path, int f_in, int f_out,
+int start_inband_exchange(c
onst c
har *user, char *path, int f_in, int f_out,
int argc)
{
int i;
int argc)
{
int i;
@@
-205,7
+206,10
@@
int start_inband_exchange(char *user, char *path, int f_in, int f_out,
return -1;
}
return -1;
}
- rprintf(FINFO, "%s\n", line);
+ /* This might be a MOTD line or a module listing, but there is
+ * no way to differentiate it. The manpage mentions this. */
+ if (output_motd)
+ rprintf(FINFO, "%s\n", line);
}
kluge_around_eof = 0;
}
kluge_around_eof = 0;
@@
-240,7
+244,9
@@
static char *finish_pre_exec(pid_t pid, int fd, char *request,
if (wait_process(pid, &status, 0) < 0
|| !WIFEXITED(status) || WEXITSTATUS(status) != 0) {
char *e;
if (wait_process(pid, &status, 0) < 0
|| !WIFEXITED(status) || WEXITSTATUS(status) != 0) {
char *e;
- if (asprintf(&e, "pre-xfer exec returned failure (%d)\n", status) < 0)
+ if (asprintf(&e, "pre-xfer exec returned failure (%d)%s%s\n",
+ status, status < 0 ? ": " : "",
+ status < 0 ? strerror(errno) : "") < 0)
out_of_memory("finish_pre_exec");
return e;
}
out_of_memory("finish_pre_exec");
return e;
}
@@
-336,7
+342,7
@@
static int rsync_module(int f_in, int f_out, int i, char *addr, char *host)
if (am_root) {
p = lp_uid(i);
if (!name_to_uid(p, &uid)) {
if (am_root) {
p = lp_uid(i);
if (!name_to_uid(p, &uid)) {
- if (!is
digit(*(unsigned char *)
p)) {
+ if (!is
Digit(
p)) {
rprintf(FLOG, "Invalid uid %s\n", p);
io_printf(f_out, "@ERROR: invalid uid %s\n", p);
return -1;
rprintf(FLOG, "Invalid uid %s\n", p);
io_printf(f_out, "@ERROR: invalid uid %s\n", p);
return -1;
@@
-346,7
+352,7
@@
static int rsync_module(int f_in, int f_out, int i, char *addr, char *host)
p = lp_gid(i);
if (!name_to_gid(p, &gid)) {
p = lp_gid(i);
if (!name_to_gid(p, &gid)) {
- if (!is
digit(*(unsigned char *)
p)) {
+ if (!is
Digit(
p)) {
rprintf(FLOG, "Invalid gid %s\n", p);
io_printf(f_out, "@ERROR: invalid gid %s\n", p);
return -1;
rprintf(FLOG, "Invalid gid %s\n", p);
io_printf(f_out, "@ERROR: invalid gid %s\n", p);
return -1;
@@
-503,7
+509,7
@@
static int rsync_module(int f_in, int f_out, int i, char *addr, char *host)
return -1;
}
return -1;
}
- if (!push_dir("/")) {
+ if (!push_dir("/"
, 0
)) {
rsyserr(FLOG, errno, "chdir %s failed\n",
lp_path(i));
io_printf(f_out, "@ERROR: chdir failed\n");
rsyserr(FLOG, errno, "chdir %s failed\n",
lp_path(i));
io_printf(f_out, "@ERROR: chdir failed\n");
@@
-511,7
+517,7
@@
static int rsync_module(int f_in, int f_out, int i, char *addr, char *host)
}
} else {
}
} else {
- if (!push_dir(lp_path(i))) {
+ if (!push_dir(lp_path(i)
, 0
)) {
rsyserr(FLOG, errno, "chdir %s failed\n",
lp_path(i));
io_printf(f_out, "@ERROR: chdir failed\n");
rsyserr(FLOG, errno, "chdir %s failed\n",
lp_path(i));
io_printf(f_out, "@ERROR: chdir failed\n");
@@
-620,6
+626,9
@@
static int rsync_module(int f_in, int f_out, int i, char *addr, char *host)
verbose = 0; /* future verbosity is controlled by client options */
ret = parse_arguments(&argc, (const char ***) &argv, 0);
quiet = 0; /* Don't let someone try to be tricky. */
verbose = 0; /* future verbosity is controlled by client options */
ret = parse_arguments(&argc, (const char ***) &argv, 0);
quiet = 0; /* Don't let someone try to be tricky. */
+ am_server = 1; /* ditto */
+ if (lp_ignore_errors(module_id))
+ ignore_errors = 1;
if (filesfrom_fd == 0)
filesfrom_fd = f_in;
if (filesfrom_fd == 0)
filesfrom_fd = f_in;
@@
-674,7
+683,7
@@
static int rsync_module(int f_in, int f_out, int i, char *addr, char *host)
if (!ret || err_msg) {
if (err_msg)
if (!ret || err_msg) {
if (err_msg)
- r
printf(FERROR, err_msg
);
+ r
write(FERROR, err_msg, strlen(err_msg)
);
else
option_error();
msleep(400);
else
option_error();
msleep(400);