Preparing for release of 3.0.6pre1
[rsync/rsync.git] / options.c
index e699ff2..b6f7bae 100644 (file)
--- a/options.c
+++ b/options.c
@@ -1357,6 +1357,12 @@ int parse_arguments(int *argc_p, const char ***argv_p)
                        "--read-batch cannot be used with --files-from\n");
                return 0;
        }
+       if (read_batch && remove_source_files) {
+               snprintf(err_buf, sizeof err_buf,
+                       "--read-batch cannot be used with --remove-%s-files\n",
+                       remove_source_files == 1 ? "source" : "sent");
+               return 0;
+       }
        if (batch_name && strlen(batch_name) > MAX_BATCH_NAME_LEN) {
                snprintf(err_buf, sizeof err_buf,
                        "the batch-file name must be %d characters or less.\n",
@@ -2083,17 +2089,18 @@ void server_options(char **args, int *argc_p)
  * (required for parsing) [ and ] chars elided from the returned string. */
 static char *parse_hostspec(char *str, char **path_start_ptr, int *port_ptr)
 {
-       char *s = str;
-       char *host_start = str;
+       char *s, *host_start = str;
        int hostlen = 0, userlen = 0;
        char *ret;
 
-       for ( ; ; s++) {
+       for (s = str; ; s++) {
                if (!*s) {
                        /* It is only OK if we run out of string with rsync:// */
-                       if (port_ptr)
-                               break;
-                       return NULL;
+                       if (!port_ptr)
+                               return NULL;
+                       if (!hostlen)
+                               hostlen = s - host_start;
+                       break;
                }
                if (*s == ':' || *s == '/') {
                        if (!hostlen)
@@ -2104,7 +2111,7 @@ static char *parse_hostspec(char *str, char **path_start_ptr, int *port_ptr)
                        } else if (port_ptr) {
                                *port_ptr = atoi(s);
                                while (isDigit(s)) s++;
-                               if (*s++ != '/')
+                               if (*s && *s++ != '/')
                                        return NULL;
                        }
                        break;