Fix --remove-source-files sanity check w/--copy-links the right way.
[rsync.git] / batch.c
diff --git a/batch.c b/batch.c
index 369d82f62ab28d182718cd44cb9c98d386497a9b..1ab66e90aeff136aefd28c4415282b9ef88e18f2 100644 (file)
--- a/batch.c
+++ b/batch.c
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 1999 Weiss
  * Copyright (C) 2004 Chris Shoemaker
- * Copyright (C) 2004-2009 Wayne Davison
+ * Copyright (C) 2004-2018 Wayne Davison
  *
  * 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
@@ -20,7 +20,7 @@
  */
 
 #include "rsync.h"
-#include "zlib/zlib.h"
+#include <zlib.h>
 #include <time.h>
 
 extern int eol_nulls;
@@ -43,7 +43,7 @@ extern char *batch_name;
 extern char *iconv_opt;
 #endif
 
-extern struct filter_list_struct filter_list;
+extern filter_rule_list filter_list;
 
 int batch_stream_flags;
 
@@ -191,12 +191,12 @@ static int write_arg(int fd, char *arg)
 
 static void write_filter_rules(int fd)
 {
-       struct filter_struct *ent;
+       filter_rule *ent;
 
        write_sbuf(fd, " <<'#E#'\n");
        for (ent = filter_list.head; ent; ent = ent->next) {
                unsigned int plen;
-               char *p = get_rule_prefix(ent->rflags, "- ", 0, &plen);
+               char *p = get_rule_prefix(ent, "- ", 0, &plen);
                write_buf(fd, p, plen);
                write_sbuf(fd, ent->pattern);
                if (ent->rflags & FILTRULE_DIRECTORY)
@@ -216,12 +216,12 @@ static void write_filter_rules(int fd)
 void write_batch_shell_file(int argc, char *argv[], int file_arg_cnt)
 {
        int fd, i, len, err = 0;
-       char *p, filename[MAXPATHLEN];
+       char *p, *p2, filename[MAXPATHLEN];
 
        stringjoin(filename, sizeof filename,
                   batch_name, ".sh", NULL);
        fd = do_open(filename, O_WRONLY | O_CREAT | O_TRUNC,
-                    S_IRUSR | S_IWUSR | S_IEXEC);
+                    S_IRUSR | S_IWUSR | S_IXUSR);
        if (fd < 0) {
                rsyserr(FERROR, errno, "Batch file %s open error",
                        filename);
@@ -267,7 +267,7 @@ void write_batch_shell_file(int argc, char *argv[], int file_arg_cnt)
                                err = 1;
                }
        }
-       if (!(p = check_for_hostspec(argv[argc - 1], &p, &i)))
+       if (!(p = check_for_hostspec(argv[argc - 1], &p2, &i)))
                p = argv[argc - 1];
        if (write(fd, " ${1:-", 6) != 6
         || write_arg(fd, p) < 0)