Split code out into separate files and remove some global variables to
reduce symbol dependencies between files and therefore make it easier
to write unit tests. The diff is large, but the actual code changes
are pretty small.
diff --git a/receiver.c b/receiver.c
index dbd8bfd..1428233 100644
--- a/receiver.c
+++ b/receiver.c
@@ -297,9 +297,10 @@
}
-/* main routine for receiver process. Receiver process runs on the
- same host as the generator process. */
-
+/**
+ * main routine for receiver process.
+ *
+ * Receiver process runs on the same host as the generator process. */
int recv_files(int f_in,struct file_list *flist,char *local_name,int f_gen)
{
int fd1,fd2;
@@ -317,6 +318,7 @@
extern struct stats stats;
extern int preserve_perms;
extern int delete_after;
+ extern int orig_umask;
struct stats initial_stats;
if (verbose > 2) {
@@ -434,7 +436,7 @@
because their information should have been previously
transferred, but that may not be the case with -R */
if (fd2 == -1 && relative_paths && errno == ENOENT &&
- create_directory_path(fnametmp) == 0) {
+ create_directory_path(fnametmp, orig_umask) == 0) {
strlcpy(fnametmp, template, sizeof(fnametmp));
fd2 = do_mkstemp(fnametmp, file->mode & INITACCESSPERMS);
}