Fix xattrs test on OS X.
[rsync/rsync.git] / options.c
index 2529fe2..3dab4a2 100644 (file)
--- a/options.c
+++ b/options.c
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 1998-2001 Andrew Tridgell <tridge@samba.org>
  * Copyright (C) 2000, 2001, 2002 Martin Pool <mbp@samba.org>
- * Copyright (C) 2002-2010 Wayne Davison
+ * Copyright (C) 2002-2011 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
@@ -604,7 +604,7 @@ static void print_rsync_version(enum logcode f)
 
        rprintf(f, "%s  version %s  protocol version %d%s\n",
                RSYNC_NAME, RSYNC_VERSION, PROTOCOL_VERSION, subprotocol);
-       rprintf(f, "Copyright (C) 1996-2010 by Andrew Tridgell, Wayne Davison, and others.\n");
+       rprintf(f, "Copyright (C) 1996-2011 by Andrew Tridgell, Wayne Davison, and others.\n");
        rprintf(f, "Web site: http://rsync.samba.org/\n");
        rprintf(f, "Capabilities:\n");
        rprintf(f, "    %d-bit files, %d-bit inums, %d-bit timestamps, %d-bit long ints,\n",
@@ -2044,17 +2044,18 @@ int parse_arguments(int *argc_p, const char ***argv_p)
                return 0;
        }
        if (backup_dir) {
+               size_t len;
                while (*backup_dir == '.' && backup_dir[1] == '/')
                        backup_dir += 2;
                if (*backup_dir == '.' && backup_dir[1] == '\0')
                        backup_dir++;
-               backup_dir_len = strlcpy(backup_dir_buf, backup_dir, sizeof backup_dir_buf);
-               backup_dir_remainder = sizeof backup_dir_buf - backup_dir_len;
-               if (backup_dir_remainder < 128) {
+               len = strlcpy(backup_dir_buf, backup_dir, sizeof backup_dir_buf);
+               if (len > sizeof backup_dir_buf - 128) {
                        snprintf(err_buf, sizeof err_buf,
                                "the --backup-dir path is WAY too long.\n");
                        return 0;
                }
+               backup_dir_len = (int)len;
                if (!backup_dir_len) {
                        backup_dir_len = -1;
                        backup_dir = NULL;
@@ -2062,6 +2063,7 @@ int parse_arguments(int *argc_p, const char ***argv_p)
                        backup_dir_buf[backup_dir_len++] = '/';
                        backup_dir_buf[backup_dir_len] = '\0';
                }
+               backup_dir_remainder = sizeof backup_dir_buf - backup_dir_len;
        }
        if (backup_dir) {
                /* No need for a suffix or a protect rule. */