Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 429462
Collapse All | Expand All

(-)a/generator.c (-1 / +2 lines)
Lines 39-44 extern int preserve_acls; Link Here
39
extern int preserve_xattrs;
39
extern int preserve_xattrs;
40
extern int preserve_links;
40
extern int preserve_links;
41
extern int preserve_devices;
41
extern int preserve_devices;
42
extern int copy_devices;
42
extern int preserve_specials;
43
extern int preserve_specials;
43
extern int preserve_hard_links;
44
extern int preserve_hard_links;
44
extern int preserve_executability;
45
extern int preserve_executability;
Lines 1751-1757 static void recv_generator(char *fname, struct file_struct *file, int ndx, Link Here
1751
		goto cleanup;
1752
		goto cleanup;
1752
	}
1753
	}
1753
1754
1754
	if (!S_ISREG(file->mode)) {
1755
	if (!(S_ISREG(file->mode) || (copy_devices && IS_DEVICE(file->mode)))) {
1755
		if (solo_file)
1756
		if (solo_file)
1756
			fname = f_name(file, NULL);
1757
			fname = f_name(file, NULL);
1757
		rprintf(FINFO, "skipping non-regular file \"%s\"\n", fname);
1758
		rprintf(FINFO, "skipping non-regular file \"%s\"\n", fname);
(-)a/options.c (+6 lines)
Lines 48-53 int append_mode = 0; Link Here
48
int keep_dirlinks = 0;
48
int keep_dirlinks = 0;
49
int copy_dirlinks = 0;
49
int copy_dirlinks = 0;
50
int copy_links = 0;
50
int copy_links = 0;
51
int copy_devices = 0;
51
int preserve_links = 0;
52
int preserve_links = 0;
52
int preserve_hard_links = 0;
53
int preserve_hard_links = 0;
53
int preserve_acls = 0;
54
int preserve_acls = 0;
Lines 348-353 void usage(enum logcode F) Link Here
348
  rprintf(F," -o, --owner                 preserve owner (super-user only)\n");
349
  rprintf(F," -o, --owner                 preserve owner (super-user only)\n");
349
  rprintf(F," -g, --group                 preserve group\n");
350
  rprintf(F," -g, --group                 preserve group\n");
350
  rprintf(F,"     --devices               preserve device files (super-user only)\n");
351
  rprintf(F,"     --devices               preserve device files (super-user only)\n");
352
  rprintf(F,"     --copy-devices          copy device contents as regular file\n");
351
  rprintf(F,"     --specials              preserve special files\n");
353
  rprintf(F,"     --specials              preserve special files\n");
352
  rprintf(F," -D                          same as --devices --specials\n");
354
  rprintf(F," -D                          same as --devices --specials\n");
353
  rprintf(F," -t, --times                 preserve modification times\n");
355
  rprintf(F," -t, --times                 preserve modification times\n");
Lines 506-511 static struct poptOption long_options[] = { Link Here
506
  {"no-D",             0,  POPT_ARG_NONE,   0, OPT_NO_D, 0, 0 },
508
  {"no-D",             0,  POPT_ARG_NONE,   0, OPT_NO_D, 0, 0 },
507
  {"devices",          0,  POPT_ARG_VAL,    &preserve_devices, 1, 0, 0 },
509
  {"devices",          0,  POPT_ARG_VAL,    &preserve_devices, 1, 0, 0 },
508
  {"no-devices",       0,  POPT_ARG_VAL,    &preserve_devices, 0, 0, 0 },
510
  {"no-devices",       0,  POPT_ARG_VAL,    &preserve_devices, 0, 0, 0 },
511
  {"copy-devices",     0,  POPT_ARG_NONE,   &copy_devices, 0, 0, 0 },
509
  {"specials",         0,  POPT_ARG_VAL,    &preserve_specials, 1, 0, 0 },
512
  {"specials",         0,  POPT_ARG_VAL,    &preserve_specials, 1, 0, 0 },
510
  {"no-specials",      0,  POPT_ARG_VAL,    &preserve_specials, 0, 0, 0 },
513
  {"no-specials",      0,  POPT_ARG_VAL,    &preserve_specials, 0, 0, 0 },
511
  {"links",           'l', POPT_ARG_VAL,    &preserve_links, 1, 0, 0 },
514
  {"links",           'l', POPT_ARG_VAL,    &preserve_links, 1, 0, 0 },
Lines 2074-2079 void server_options(char **args, int *argc_p) Link Here
2074
	else if (remove_source_files)
2077
	else if (remove_source_files)
2075
		args[ac++] = "--remove-sent-files";
2078
		args[ac++] = "--remove-sent-files";
2076
2079
2080
	if (copy_devices)
2081
		args[ac++] = "--copy-devices";
2082
2077
	if (ac > MAX_SERVER_ARGS) { /* Not possible... */
2083
	if (ac > MAX_SERVER_ARGS) { /* Not possible... */
2078
		rprintf(FERROR, "argc overflow in server_options().\n");
2084
		rprintf(FERROR, "argc overflow in server_options().\n");
2079
		exit_cleanup(RERR_MALLOC);
2085
		exit_cleanup(RERR_MALLOC);
(-)a/rsync.c (-1 / +3 lines)
Lines 34-39 extern int preserve_xattrs; Link Here
34
extern int preserve_perms;
34
extern int preserve_perms;
35
extern int preserve_executability;
35
extern int preserve_executability;
36
extern int preserve_times;
36
extern int preserve_times;
37
extern int copy_devices;
37
extern int am_root;
38
extern int am_root;
38
extern int am_server;
39
extern int am_server;
39
extern int am_sender;
40
extern int am_sender;
Lines 326-332 int read_ndx_and_attrs(int f_in, int *iflag_ptr, uchar *type_ptr, Link Here
326
327
327
	if (iflags & ITEM_TRANSFER) {
328
	if (iflags & ITEM_TRANSFER) {
328
		int i = ndx - cur_flist->ndx_start;
329
		int i = ndx - cur_flist->ndx_start;
329
		if (i < 0 || !S_ISREG(cur_flist->files[i]->mode)) {
330
		struct file_struct *file = cur_flist->files[i];
331
		if (i < 0 || !(S_ISREG(file->mode) || (copy_devices && IS_DEVICE(file->mode)))) {
330
			rprintf(FERROR,
332
			rprintf(FERROR,
331
				"received request to transfer non-regular file: %d [%s]\n",
333
				"received request to transfer non-regular file: %d [%s]\n",
332
				ndx, who_am_i());
334
				ndx, who_am_i());
(-)a/sender.c (+14 lines)
Lines 309-314 void send_files(int f_in, int f_out) Link Here
309
			exit_cleanup(RERR_PROTOCOL);
309
			exit_cleanup(RERR_PROTOCOL);
310
		}
310
		}
311
311
312
		/* On Linux systems (at least), st_size is typically 0 for devices.
313
		 * If so, try to determine the actual device size. */
314
		if (IS_DEVICE(st.st_mode) && st.st_size == 0) {
315
			OFF_T off = lseek(fd, 0, SEEK_END);
316
			if (off == (OFF_T) -1)
317
				rsyserr(FERROR, errno, "failed to seek to end of %s to determine size", fname);
318
			else {
319
				st.st_size = off;
320
				off = lseek(fd, 0, SEEK_SET);
321
				if (off != 0)
322
					rsyserr(FERROR, errno, "failed to seek back to beginning of %s to read it", fname);
323
			}
324
		}
325
312
		if (st.st_size) {
326
		if (st.st_size) {
313
			int32 read_size = MAX(s->blength * 3, MAX_MAP_SIZE);
327
			int32 read_size = MAX(s->blength * 3, MAX_MAP_SIZE);
314
			mbuf = map_file(fd, st.st_size, read_size, s->blength);
328
			mbuf = map_file(fd, st.st_size, read_size, s->blength);

Return to bug 429462