Matt McCutchen's Web Site
/
rsync
/
rsync.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixed some itemized logging failures:
[rsync/rsync.git]
/
hlink.c
diff --git
a/hlink.c
b/hlink.c
index
962261c
..
2a8b77e
100644
(file)
--- a/
hlink.c
+++ b/
hlink.c
@@
-4,7
+4,7
@@
* Copyright (C) 1996 Andrew Tridgell
* Copyright (C) 1996 Paul Mackerras
* Copyright (C) 2002 Martin Pool <mbp@samba.org>
* Copyright (C) 1996 Andrew Tridgell
* Copyright (C) 1996 Paul Mackerras
* Copyright (C) 2002 Martin Pool <mbp@samba.org>
- * Copyright (C) 2004-200
7
Wayne Davison
+ * Copyright (C) 2004-200
8
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
*
* 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
@@
-24,6
+24,7
@@
extern int verbose;
extern int dry_run;
extern int verbose;
extern int dry_run;
+extern int list_only;
extern int am_sender;
extern int inc_recurse;
extern int do_xfers;
extern int am_sender;
extern int inc_recurse;
extern int do_xfers;
@@
-142,7
+143,7
@@
static void match_gnums(int32 *ndx_list, int ndx_count)
if (gnum != gnum_next)
break;
F_HL_PREV(file) = prev;
if (gnum != gnum_next)
break;
F_HL_PREV(file) = prev;
- /* The linked list
must use raw
ndx values. */
+ /* The linked list
uses over-the-wire
ndx values. */
if (unsort_ndx)
prev = F_NDX(file);
else
if (unsort_ndx)
prev = F_NDX(file);
else
@@
-174,23
+175,25
@@
static void match_gnums(int32 *ndx_list, int ndx_count)
* to first when we're done. */
void match_hard_links(struct file_list *flist)
{
* to first when we're done. */
void match_hard_links(struct file_list *flist)
{
- int i, ndx_count = 0;
- int32 *ndx_list;
+ if (!list_only) {
+ int i, ndx_count = 0;
+ int32 *ndx_list;
- if (!(ndx_list = new_array(int32, flist->used)))
- out_of_memory("match_hard_links");
+
if (!(ndx_list = new_array(int32, flist->used)))
+
out_of_memory("match_hard_links");
- for (i = 0; i < flist->used; i++) {
- if (F_IS_HLINKED(flist->sorted[i]))
- ndx_list[ndx_count++] = i;
- }
+
for (i = 0; i < flist->used; i++) {
+
if (F_IS_HLINKED(flist->sorted[i]))
+
ndx_list[ndx_count++] = i;
+
}
- hlink_flist = flist;
+
hlink_flist = flist;
- if (ndx_count)
- match_gnums(ndx_list, ndx_count);
+
if (ndx_count)
+
match_gnums(ndx_list, ndx_count);
- free(ndx_list);
+ free(ndx_list);
+ }
if (protocol_version < 30)
idev_destroy();
}
if (protocol_version < 30)
idev_destroy();
}
@@
-217,7
+220,7
@@
static int maybe_hard_link(struct file_struct *file, int ndx,
if (!make_backup(fname))
return -1;
} else if (robust_unlink(fname)) {
if (!make_backup(fname))
return -1;
} else if (robust_unlink(fname)) {
- rsyserr(FERROR, errno, "unlink %s failed",
+ rsyserr(FERROR
_XFER
, errno, "unlink %s failed",
full_fname(fname));
return -1;
}
full_fname(fname));
return -1;
}
@@
-272,13
+275,13
@@
int hard_link_check(struct file_struct *file, int ndx, const char *fname,
if (!prev_name) {
struct file_struct *prev_file = flist->files[prev_ndx - flist->ndx_start];
if (!prev_name) {
struct file_struct *prev_file = flist->files[prev_ndx - flist->ndx_start];
- /* Is the previous link
is
not complete yet? */
+ /* Is the previous link not complete yet? */
if (!(prev_file->flags & FLAG_HLINK_DONE)) {
/* Is the previous link being transferred? */
if (prev_file->flags & FLAG_FILE_SENT) {
if (!(prev_file->flags & FLAG_HLINK_DONE)) {
/* Is the previous link being transferred? */
if (prev_file->flags & FLAG_FILE_SENT) {
- /* Add ourselves to the list of files that will
be
- *
updated when the transfer completes, and mark
- * ourself as waiting for the transfer. */
+ /* Add ourselves to the list of files that will
+ *
be updated when the transfer completes, and
+ *
mark
ourself as waiting for the transfer. */
F_HL_PREV(file) = F_HL_PREV(prev_file);
F_HL_PREV(prev_file) = ndx;
file->flags |= FLAG_FILE_SENT;
F_HL_PREV(file) = F_HL_PREV(prev_file);
F_HL_PREV(prev_file) = ndx;
file->flags |= FLAG_FILE_SENT;
@@
-317,7
+320,7
@@
int hard_link_check(struct file_struct *file, int ndx, const char *fname,
}
if (link_stat(prev_name, &prev_st, 0) < 0) {
}
if (link_stat(prev_name, &prev_st, 0) < 0) {
- rsyserr(FERROR, errno, "stat %s failed",
+ rsyserr(FERROR
_XFER
, errno, "stat %s failed",
full_fname(prev_name));
return -1;
}
full_fname(prev_name));
return -1;
}
@@
-390,10
+393,10
@@
int hard_link_one(struct file_struct *file, const char *fname,
enum logcode code;
if (terse) {
if (!verbose)
enum logcode code;
if (terse) {
if (!verbose)
- return
-1
;
+ return
0
;
code = FINFO;
} else
code = FINFO;
} else
- code = FERROR;
+ code = FERROR
_XFER
;
rsyserr(code, errno, "link %s => %s failed",
full_fname(fname), oldname);
return 0;
rsyserr(code, errno, "link %s => %s failed",
full_fname(fname), oldname);
return 0;
@@
-417,7
+420,7
@@
void finish_hard_link(struct file_struct *file, const char *fname, int fin_ndx,
if (stp == NULL && prev_ndx >= 0) {
if (link_stat(fname, &st, 0) < 0) {
if (stp == NULL && prev_ndx >= 0) {
if (link_stat(fname, &st, 0) < 0) {
- rsyserr(FERROR, errno, "stat %s failed",
+ rsyserr(FERROR
_XFER
, errno, "stat %s failed",
full_fname(fname));
return;
}
full_fname(fname));
return;
}