29
29
extern int preserve_uid;
30
30
extern int preserve_gid;
31
31
extern int relative_paths;
32
@@ -303,6 +304,9 @@ static void send_file_entry(struct file_
32
@@ -305,6 +306,9 @@ static void send_file_entry(struct file_
33
33
unsigned short flags;
34
34
static time_t modtime;
35
35
static mode_t mode;
41
41
static uint32 rdev_major;
42
@@ -333,6 +337,12 @@ static void send_file_entry(struct file_
42
@@ -335,6 +339,12 @@ static void send_file_entry(struct file_
43
43
flags |= XMIT_SAME_MODE;
52
52
if ((preserve_devices && IS_DEVICE(mode))
53
53
|| (preserve_specials && IS_SPECIAL(mode))) {
54
54
if (protocol_version < 28) {
55
@@ -416,6 +426,10 @@ static void send_file_entry(struct file_
55
@@ -418,6 +428,10 @@ static void send_file_entry(struct file_
56
56
write_int(f, modtime);
57
57
if (!(flags & XMIT_SAME_MODE))
58
58
write_int(f, to_wire_mode(mode));
63
63
if (preserve_uid && !(flags & XMIT_SAME_UID)) {
66
@@ -483,6 +497,9 @@ static struct file_struct *receive_file_
66
@@ -485,6 +499,9 @@ static struct file_struct *receive_file_
68
68
static time_t modtime;
69
69
static mode_t mode;
75
75
static uint32 rdev_major;
76
@@ -556,9 +573,12 @@ static struct file_struct *receive_file_
76
@@ -558,9 +575,12 @@ static struct file_struct *receive_file_
77
77
modtime = (time_t)read_int(f);
78
78
if (!(flags & XMIT_SAME_MODE))
79
79
mode = from_wire_mode(read_int(f));
88
88
if (preserve_uid && !(flags & XMIT_SAME_UID))
89
89
uid = (uid_t)read_int(f);
90
@@ -609,6 +629,9 @@ static struct file_struct *receive_file_
90
@@ -611,6 +631,9 @@ static struct file_struct *receive_file_
91
91
file->modtime = modtime;
92
92
file->length = file_length;
100
@@ -862,6 +885,9 @@ struct file_struct *make_file(char *fnam
100
@@ -871,6 +894,9 @@ struct file_struct *make_file(char *fnam
101
101
file->modtime = st.st_mtime;
102
102
file->length = st.st_size;
103
103
file->mode = st.st_mode;
110
110
--- old/generator.c
111
111
+++ new/generator.c
112
@@ -95,6 +95,12 @@ extern struct filter_list_struct server_
112
@@ -98,6 +98,12 @@ int non_perishable_cnt = 0;
114
114
static int deletion_count = 0; /* used to implement --max-delete */
119
119
+#define FILEFLAGS(ff) 0
122
/* For calling delete_item() */
122
/* For calling delete_item() and delete_dir_contents(). */
123
123
#define DEL_RECURSE (1<<1) /* recurse */
125
@@ -109,7 +115,6 @@ enum delret {
124
#define DEL_DIR_IS_EMPTY (1<<2) /* internal delete_FUNCTIONS use only */
125
@@ -113,7 +119,6 @@ enum delret {
126
126
/* Forward declaration for delete_item(). */
127
127
static enum delret delete_dir_contents(char *fname, int flags);
130
130
static int is_backup_file(char *fn)
132
132
int k = strlen(fn) - backup_suffix_len;
133
@@ -122,17 +127,20 @@ static int is_backup_file(char *fn)
133
@@ -126,17 +131,20 @@ static int is_backup_file(char *fn)
134
134
* Note that fname must point to a MAXPATHLEN buffer if the mode indicates it's
135
135
* a directory! (The buffer is used for recursion, but returned unchanged.)
151
151
+#ifdef SUPPORT_FLAGS
152
152
+ make_mutable(fname, mode, fileflags);
154
if (S_ISDIR(mode) && flags & DEL_RECURSE) {
155
ret = delete_dir_contents(fname, flags);
156
if (ret == DR_PINNED || ret == DR_NOT_EMPTY
157
@@ -221,7 +229,7 @@ static enum delret delete_dir_contents(c
154
if (S_ISDIR(mode) && !(flags & DEL_DIR_IS_EMPTY)) {
155
ignore_perishable = 1;
156
/* If DEL_RECURSE is not set, this just reports emptiness. */
157
@@ -248,7 +256,7 @@ static enum delret delete_dir_contents(c
158
if (S_ISDIR(fp->mode)
159
&& delete_dir_contents(fname, flags | DEL_RECURSE) != DR_SUCCESS)
161
- if (delete_item(fname, fp->mode, NULL, flags) != DR_SUCCESS)
162
+ if (delete_item(fname, fp->mode, FILEFLAGS(fp->fileflags), NULL, flags) != DR_SUCCESS)
160
strlcpy(p, fp->basename, remainder);
161
- result = delete_item(fname, fp->mode, NULL, flags);
162
+ result = delete_item(fname, fp->mode, FILEFLAGS(fp->fileflags), NULL, flags);
163
if (result != DR_SUCCESS && ret == DR_SUCCESS)
164
ret = result == DR_PINNED ? result : DR_NOT_EMPTY;
166
@@ -307,7 +315,7 @@ static void delete_in_dir(struct file_li
166
@@ -338,7 +346,7 @@ static void delete_in_dir(struct file_li
168
168
if (flist_find(flist, fp) < 0) {
169
169
f_name(fp, delbuf);
175
@@ -1005,7 +1013,7 @@ static void recv_generator(char *fname,
175
@@ -1036,7 +1044,7 @@ static void recv_generator(char *fname,
176
176
* we need to delete it. If it doesn't exist, then
177
177
* (perhaps recursively) create it. */
178
178
if (statret == 0 && !S_ISDIR(st.st_mode)) {
184
@@ -1099,7 +1107,7 @@ static void recv_generator(char *fname,
184
@@ -1130,7 +1138,7 @@ static void recv_generator(char *fname,
186
186
/* Not the right symlink (or not a symlink), so
191
191
} else if (basis_dir[0] != NULL) {
192
192
int j = try_dests_non(file, fname, ndx, fnamecmpbuf, &st,
193
@@ -1170,7 +1178,7 @@ static void recv_generator(char *fname,
193
@@ -1201,7 +1209,7 @@ static void recv_generator(char *fname,
194
194
goto return_with_success;
200
200
} else if (basis_dir[0] != NULL) {
201
201
int j = try_dests_non(file, fname, ndx, fnamecmpbuf, &st,
202
@@ -1256,7 +1264,7 @@ static void recv_generator(char *fname,
202
@@ -1287,7 +1295,7 @@ static void recv_generator(char *fname,
203
203
fnamecmp_type = FNAMECMP_FNAME;
205
205
if (statret == 0 && !S_ISREG(st.st_mode)) {