aboutsummaryrefslogtreecommitdiffstats
path: root/cleanup.c
diff options
context:
space:
mode:
authorDavid Dykstra <dwd@samba.org>1998-10-26 21:51:47 +0000
committerDavid Dykstra <dwd@samba.org>1998-10-26 21:51:47 +0000
commit8638dd48f71023642d3af282250bbe157ee9b67d (patch)
treedc7775fc863e859a3aed08bdbc88bd1ef4886c45 /cleanup.c
parent2bca43f6278dcc0aa19a2620c1f1e2387b2e7b07 (diff)
downloadandroid_external_rsync-8638dd48f71023642d3af282250bbe157ee9b67d.tar.gz
android_external_rsync-8638dd48f71023642d3af282250bbe157ee9b67d.tar.bz2
android_external_rsync-8638dd48f71023642d3af282250bbe157ee9b67d.zip
Add "use chroot" and "pid file" rsyncd.conf options. The former allows one
to disable the use of chroot so rsync --daemon can be run as a non-root user (if a non-privileged --port is used). The latter allows one to specify a file in which to write the process id of the daemon, which is useful when rsync --daemon is not run from inetd.
Diffstat (limited to 'cleanup.c')
-rw-r--r--cleanup.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/cleanup.c b/cleanup.c
index 57fce18f..abd7b0df 100644
--- a/cleanup.c
+++ b/cleanup.c
@@ -29,6 +29,7 @@ static char *cleanup_new_fname;
static struct file_struct *cleanup_file;
static int cleanup_fd1, cleanup_fd2;
static struct map_struct *cleanup_buf;
+static int cleanup_pid = 0;
void exit_cleanup(int code)
{
@@ -50,6 +51,8 @@ void exit_cleanup(int code)
if (code) {
kill_all(SIGUSR1);
}
+ if ((cleanup_pid != 0) && (cleanup_pid == (int) getpid()))
+ unlink(lp_pid_file());
exit(code);
}
@@ -70,3 +73,8 @@ void cleanup_set(char *fnametmp, char *fname, struct file_struct *file,
cleanup_fd1 = fd1;
cleanup_fd2 = fd2;
}
+
+void cleanup_set_pid(int pid)
+{
+ cleanup_pid = pid;
+}