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
Tweaked a comment.
[rsync/rsync.git]
/
hlink.c
diff --git
a/hlink.c
b/hlink.c
index
3ee8433
..
e09a2db
100644
(file)
--- a/
hlink.c
+++ b/
hlink.c
@@
-24,7
+24,7
@@
extern int dry_run;
extern int verbose;
extern int make_backups;
extern int verbose;
extern int make_backups;
-#if SUPPORT_HARD_LINKS
+#if
def
SUPPORT_HARD_LINKS
static int hlink_compare(struct file_struct **file1, struct file_struct **file2)
{
struct file_struct *f1 = *file1;
static int hlink_compare(struct file_struct **file1, struct file_struct **file2)
{
struct file_struct *f1 = *file1;
@@
-36,7
+36,7
@@
static int hlink_compare(struct file_struct **file1, struct file_struct **file2)
if (f1->F_INODE != f2->F_INODE)
return (int) (f1->F_INODE > f2->F_INODE ? 1 : -1);
if (f1->F_INODE != f2->F_INODE)
return (int) (f1->F_INODE > f2->F_INODE ? 1 : -1);
- return f
ile_compare(file1, file
2);
+ return f
_name_cmp(f1, f
2);
}
static struct file_struct **hlink_list;
}
static struct file_struct **hlink_list;
@@
-104,7
+104,7
@@
static void link_idev_data(struct file_list *flist)
void init_hard_links(struct file_list *flist)
{
void init_hard_links(struct file_list *flist)
{
-#if SUPPORT_HARD_LINKS
+#if
def
SUPPORT_HARD_LINKS
int i;
if (flist->count < 2)
int i;
if (flist->count < 2)
@@
-135,6
+135,7
@@
void init_hard_links(struct file_list *flist)
int hard_link_check(struct file_struct *file, int skip)
{
int hard_link_check(struct file_struct *file, int skip)
{
+#ifdef SUPPORT_HARD_LINKS
if (!hlink_list || !file->link_u.links)
return 0;
if (skip && !(file->flags & FLAG_HLINK_EOL))
if (!hlink_list || !file->link_u.links)
return 0;
if (skip && !(file->flags & FLAG_HLINK_EOL))
@@
-142,24
+143,25
@@
int hard_link_check(struct file_struct *file, int skip)
if (hlink_list[file->F_HLINDEX] != file) {
if (verbose > 1) {
rprintf(FINFO, "\"%s\" is a hard link\n",
if (hlink_list[file->F_HLINDEX] != file) {
if (verbose > 1) {
rprintf(FINFO, "\"%s\" is a hard link\n",
-
f_name(file
));
+
safe_fname(f_name(file)
));
}
return 1;
}
}
return 1;
}
+#endif
return 0;
}
return 0;
}
-#if SUPPORT_HARD_LINKS
+#if
def
SUPPORT_HARD_LINKS
static void hard_link_one(char *hlink1, char *hlink2)
{
if (do_link(hlink1, hlink2)) {
if (verbose) {
static void hard_link_one(char *hlink1, char *hlink2)
{
if (do_link(hlink1, hlink2)) {
if (verbose) {
- r
printf(FINFO, "link %s => %s failed: %s\n
",
-
hlink2, hlink1, strerror(errno
));
+ r
syserr(FINFO, errno, "link %s => %s failed
",
+
full_fname(hlink2), safe_fname(hlink1
));
}
}
else if (verbose)
}
}
else if (verbose)
- rprintf(FINFO, "%s => %s\n",
hlink2, hlink1
);
+ rprintf(FINFO, "%s => %s\n",
safe_fname(hlink2), safe_fname(hlink1)
);
}
#endif
}
#endif
@@
-169,9
+171,9
@@
static void hard_link_one(char *hlink1, char *hlink2)
* Create any hard links in the global hlink_list. They were put
* there by running init_hard_links on the filelist.
**/
* Create any hard links in the global hlink_list. They were put
* there by running init_hard_links on the filelist.
**/
-void do_hard_links(
void
)
+void do_hard_links(
int allowed_lull, int flist_count
)
{
{
-#if SUPPORT_HARD_LINKS
+#if
def
SUPPORT_HARD_LINKS
struct file_struct *file, *first;
char hlink1[MAXPATHLEN];
char *hlink2;
struct file_struct *file, *first;
char hlink1[MAXPATHLEN];
char *hlink2;
@@
-183,11
+185,11
@@
void do_hard_links(void)
for (i = 0; i < hlink_count; i++) {
first = file = hlink_list[i];
for (i = 0; i < hlink_count; i++) {
first = file = hlink_list[i];
- if (link_stat(f_name_to(first, hlink1), &st1
) !=
0)
+ if (link_stat(f_name_to(first, hlink1), &st1
, 0) <
0)
continue;
while ((file = file->F_NEXT) != first) {
hlink2 = f_name(file);
continue;
while ((file = file->F_NEXT) != first) {
hlink2 = f_name(file);
- if (link_stat(hlink2, &st2) == 0) {
+ if (link_stat(hlink2, &st2
, 0
) == 0) {
if (st2.st_dev == st1.st_dev
&& st2.st_ino == st1.st_ino)
continue;
if (st2.st_dev == st1.st_dev
&& st2.st_ino == st1.st_ino)
continue;
@@
-196,16
+198,17
@@
void do_hard_links(void)
continue;
} else if (robust_unlink(hlink2)) {
if (verbose > 0) {
continue;
} else if (robust_unlink(hlink2)) {
if (verbose > 0) {
- rprintf(FINFO,
- "unlink %s failed: %s\n",
- full_fname(hlink2),
- strerror(errno));
+ rsyserr(FINFO, errno,
+ "unlink %s failed",
+ full_fname(hlink2));
}
continue;
}
}
hard_link_one(hlink1, hlink2);
}
}
continue;
}
}
hard_link_one(hlink1, hlink2);
}
+ if (allowed_lull)
+ maybe_send_keepalive(allowed_lull, flist_count);
}
#endif
}
}
#endif
}