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
fixed a bug that made us use only 16 bits of the file checksum when
[rsync/rsync.git]
/
clientserver.c
diff --git
a/clientserver.c
b/clientserver.c
index
7b0dd16
..
ace360b
100644
(file)
--- a/
clientserver.c
+++ b/
clientserver.c
@@
-34,7
+34,6
@@
int start_socket_client(char *host, char *path, int argc, char *argv[])
char line[MAXPATHLEN];
char *p, *user=NULL;
extern int remote_version;
char line[MAXPATHLEN];
char *p, *user=NULL;
extern int remote_version;
- extern int am_client;
extern int am_sender;
if (*path == '/') {
extern int am_sender;
if (*path == '/') {
@@
-52,8
+51,6
@@
int start_socket_client(char *host, char *path, int argc, char *argv[])
if (!user) user = getenv("USER");
if (!user) user = getenv("LOGNAME");
if (!user) user = getenv("USER");
if (!user) user = getenv("LOGNAME");
- am_client = 1;
-
fd = open_socket_out(host, rsync_port);
if (fd == -1) {
exit_cleanup(RERR_SOCKETIO);
fd = open_socket_out(host, rsync_port);
if (fd == -1) {
exit_cleanup(RERR_SOCKETIO);
@@
-292,7
+289,7
@@
static int rsync_module(int fd, int i)
}
}
}
}
- ret = parse_arguments(argc, argv);
+ ret = parse_arguments(argc, argv
, 0
);
if (request) {
if (*auth_user) {
if (request) {
if (*auth_user) {
@@
-420,6
+417,7
@@
static int start_daemon(int fd)
int daemon_main(void)
{
extern char *config_file;
int daemon_main(void)
{
extern char *config_file;
+ extern int orig_umask;
char *pid_file;
if (is_a_socket(STDIN_FILENO)) {
char *pid_file;
if (is_a_socket(STDIN_FILENO)) {
@@
-450,16
+448,19
@@
int daemon_main(void)
rprintf(FINFO,"rsyncd version %s starting\n",VERSION);
if (((pid_file = lp_pid_file()) != NULL) && (*pid_file != '\0')) {
rprintf(FINFO,"rsyncd version %s starting\n",VERSION);
if (((pid_file = lp_pid_file()) != NULL) && (*pid_file != '\0')) {
- FILE *f;
+ char pidbuf[16];
+ int fd;
int pid = (int) getpid();
cleanup_set_pid(pid);
int pid = (int) getpid();
cleanup_set_pid(pid);
- if ((f = fopen(lp_pid_file(), "w")) == NULL) {
+ if ((fd = do_open(lp_pid_file(), O_WRONLY|O_CREAT|O_TRUNC,
+ 0666 & ~orig_umask)) == -1) {
cleanup_set_pid(0);
fprintf(stderr,"failed to create pid file %s\n", pid_file);
exit_cleanup(RERR_FILEIO);
}
cleanup_set_pid(0);
fprintf(stderr,"failed to create pid file %s\n", pid_file);
exit_cleanup(RERR_FILEIO);
}
- fprintf(f, "%d\n", pid);
- fclose(f);
+ slprintf(pidbuf, sizeof(pidbuf), "%d\n", pid);
+ write(fd, pidbuf, strlen(pidbuf));
+ close(fd);
}
start_accept_loop(rsync_port, start_daemon);
}
start_accept_loop(rsync_port, start_daemon);