Check the right flist_num in gen_wants_ndx().
[rsync/rsync.git] / flist.c
diff --git a/flist.c b/flist.c
index 149adf1..3e79ce1 100644 (file)
--- a/flist.c
+++ b/flist.c
@@ -4,7 +4,7 @@
  * Copyright (C) 1996 Andrew Tridgell
  * Copyright (C) 1996 Paul Mackerras
  * Copyright (C) 2001, 2002 Martin Pool <mbp@samba.org>
- * Copyright (C) 2002-2008 Wayne Davison
+ * Copyright (C) 2002-2009 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
@@ -1378,6 +1378,7 @@ static struct file_struct *send_file_name(int f, struct file_list *flist,
 #endif
 #if defined SUPPORT_ACLS || defined SUPPORT_XATTRS
                stat_x sx;
+               init_stat_x(&sx);
 #endif
 
 #ifdef SUPPORT_LINKS
@@ -1441,7 +1442,6 @@ static struct file_struct *send_file_name(int f, struct file_list *flist,
 #ifdef SUPPORT_ACLS
                if (preserve_acls && !S_ISLNK(file->mode)) {
                        sx.st.st_mode = file->mode;
-                       sx.acc_acl = sx.def_acl = NULL;
                        if (get_acl(fname, &sx) < 0) {
                                io_error |= IOERR_GENERAL;
                                return NULL;
@@ -1450,7 +1450,6 @@ static struct file_struct *send_file_name(int f, struct file_list *flist,
 #endif
 #ifdef SUPPORT_XATTRS
                if (preserve_xattrs) {
-                       sx.xattr = NULL;
                        if (get_xattr(fname, &sx) < 0) {
                                io_error |= IOERR_GENERAL;
                                return NULL;
@@ -1639,6 +1638,8 @@ static void send_directory(int f, struct file_list *flist, char *fbuf, int len,
        assert(flist != NULL);
 
        if (!(d = opendir(fbuf))) {
+               if (errno == ENOENT)
+                       return;
                io_error |= IOERR_GENERAL;
                rsyserr(FERROR_XFER, errno, "opendir %s failed", full_fname(fbuf));
                return;
@@ -1914,7 +1915,7 @@ void send_extra_file_list(int f, int at_least)
                        write_byte(f, 0);
                else {
                        write_shortint(f, XMIT_EXTENDED_FLAGS|XMIT_IO_ERROR_ENDLIST);
-                       write_int(f, io_error);
+                       write_varint(f, io_error);
                }
 
                if (need_unsorted_flist) {
@@ -2217,7 +2218,7 @@ struct file_list *send_file_list(int f, int argc, char *argv[])
                write_byte(f, 0);
        else {
                write_shortint(f, XMIT_EXTENDED_FLAGS|XMIT_IO_ERROR_ENDLIST);
-               write_int(f, io_error);
+               write_varint(f, io_error);
        }
 
 #ifdef SUPPORT_HARD_LINKS
@@ -2340,7 +2341,7 @@ struct file_list *recv_file_list(int f)
                                rprintf(FERROR, "Invalid flist flag: %x\n", flags);
                                exit_cleanup(RERR_PROTOCOL);
                        }
-                       err = read_int(f);
+                       err = read_varint(f);
                        if (!ignore_errors)
                                io_error |= err;
                        break;