if (preserve_links && S_ISLNK(f->mode)) {
rprintf(FINFO, "%s %11.0f %s %s -> %s\n",
perms,
- (double) f->length, timestring(f->modtime),
+ (double)f->length, timestring(f->modtime),
f_name(f), f->u.link);
} else
#endif
rprintf(FINFO, "%s %11.0f %s %s\n",
perms,
- (double) f->length, timestring(f->modtime),
+ (double)f->length, timestring(f->modtime),
f_name(f));
}
if (do_lstat(path, buffer) == -1)
return -1;
if (S_ISLNK(buffer->st_mode)) {
- int l = readlink((char *) path, linkbuf, MAXPATHLEN - 1);
+ int l = readlink((char *)path, linkbuf, MAXPATHLEN - 1);
if (l == -1)
return -1;
linkbuf[l] = 0;
#endif
}
-int link_stat(const char *path, STRUCT_STAT * buffer)
+int link_stat(const char *path, STRUCT_STAT *buffer)
{
#if SUPPORT_LINKS
if (copy_links)
if (S_ISLNK(mode) && (_S_IFLNK != 0120000))
return (mode & ~(_S_IFMT)) | 0120000;
#endif
- return (int) mode;
+ return (int)mode;
}
static mode_t from_wire_mode(int mode)
{
if ((mode & (_S_IFMT)) == 0120000 && (_S_IFLNK != 0120000))
return (mode & ~(_S_IFMT)) | _S_IFLNK;
- return (mode_t) mode;
+ return (mode_t)mode;
}
if (verbose >= 2) {
rprintf(FINFO, "[%s] expand file_list to %.0f bytes, did%s move\n",
who_am_i(),
- (double) sizeof flist->files[0] * flist->malloced,
+ (double)sizeof flist->files[0] * flist->malloced,
(new_ptr == flist->files) ? " not" : "");
}
static uid_t uid;
static gid_t gid;
static char lastname[MAXPATHLEN];
- char *fname, fbuf[MAXPATHLEN];
+ char fname[MAXPATHLEN];
int l1, l2;
if (f == -1)
io_write_phase = "send_file_entry";
- fname = f_name_to(file, fbuf);
+ f_name_to(file, fname);
flags = base_flags;
if (readlink_stat(thisname, &st, linkname) != 0) {
int save_errno = errno;
- if (errno == ENOENT) {
- enum logcode c = am_daemon && protocol_version < 28
- ? FERROR : FINFO;
- /* either symlink pointing nowhere or file that
- * was removed during rsync run; see if excluded
- * before reporting an error */
- if (exclude_level != NO_EXCLUDES
- && check_exclude_file(thisname, 0, exclude_level)) {
- /* file is excluded anyway, ignore silently */
- return NULL;
+ /* See if file is excluded before reporting an error. */
+ if (exclude_level != NO_EXCLUDES
+ && check_exclude_file(thisname, 0, exclude_level))
+ return NULL;
+ if (save_errno == ENOENT) {
+ /* Avoid "vanished" error if symlink points nowhere. */
+ if (copy_links && do_lstat(thisname, &st) == 0
+ && S_ISLNK(st.st_mode)) {
+ io_error |= IOERR_GENERAL;
+ rprintf(FERROR, "symlink has no referent: %s\n",
+ full_fname(thisname));
+ } else {
+ enum logcode c = am_daemon && protocol_version < 28
+ ? FERROR : FINFO;
+ io_error |= IOERR_VANISHED;
+ rprintf(c, "file has vanished: %s\n",
+ full_fname(thisname));
}
- io_error |= IOERR_VANISHED;
- rprintf(c, "file has vanished: %s\n",
- full_fname(thisname));
- }
- else {
+ } else {
io_error |= IOERR_GENERAL;
rsyserr(FERROR, save_errno, "readlink %s failed",
full_fname(thisname));
return;
qsort(flist->files, flist->count,
- sizeof flist->files[0], (int (*)()) file_compare);
+ sizeof flist->files[0], (int (*)())file_compare);
for (i = no_dups? 0 : flist->count; i < flist->count; i++) {
if (flist->files[i]->basename) {
*gidbuf = '\0';
rprintf(FINFO, "[%s] i=%d %s %s %s mode=0%o len=%.0f%s%s\n",
who_am_i(), i, NS(file->basedir), NS(file->dirname),
- NS(file->basename), (int) file->mode,
- (double) file->length, uidbuf, gidbuf);
+ NS(file->basename), (int)file->mode,
+ (double)file->length, uidbuf, gidbuf);
}
}