That should have been -s.
[rsync/rsync.git] / main.c
diff --git a/main.c b/main.c
index efcd060..188a99e 100644 (file)
--- a/main.c
+++ b/main.c
@@ -71,11 +71,10 @@ extern char *shell_cmd;
 extern char *batch_name;
 extern char *password_file;
 extern char curr_dir[MAXPATHLEN];
-extern struct file_list *cur_flist;
+extern struct file_list *first_flist;
 extern struct filter_list_struct server_filter_list;
 
 int local_server = 0;
-int new_root_dir = 0;
 int daemon_over_rsh = 0;
 mode_t orig_umask = 0;
 int batch_gen_fd = -1;
@@ -560,7 +559,8 @@ static char *get_local_name(struct file_list *flist, char *dest_path)
                        exit_cleanup(RERR_FILEIO);
                }
 
-               new_root_dir = 1;
+               if (strcmp(flist->files[0]->basename, ".") == 0)
+                       flist->files[0]->flags |= FLAG_DIR_CREATED;
 
                if (verbose)
                        rprintf(FINFO, "created directory %s\n", dest_path);
@@ -721,7 +721,7 @@ static int do_recv(int f_in, int f_out, char *local_name)
 
 #ifdef SUPPORT_HARD_LINKS
        if (preserve_hard_links && !inc_recurse)
-               match_hard_links(cur_flist);
+               match_hard_links(first_flist);
 #endif
 
        if (fd_pair(error_pipe) < 0) {
@@ -796,6 +796,14 @@ static int do_recv(int f_in, int f_out, char *local_name)
        set_msg_fd_in(error_pipe[0]);
        io_start_buffering_in(error_pipe[0]);
 
+#ifdef SUPPORT_HARD_LINKS
+       if (preserve_hard_links && inc_recurse) {
+               struct file_list *flist;
+               for (flist = first_flist; flist; flist = flist->next)
+                       match_hard_links(flist);
+       }
+#endif
+
        generate_files(f_out, local_name);
 
        handle_stats(-1);