int compat_flags;
if (am_server) {
compat_flags = allow_inc_recurse ? CF_INC_RECURSE : 0;
-#if defined HAVE_LUTIMES && defined HAVE_UTIMES
+#ifdef CAN_SET_SYMLINK_TIMES
compat_flags |= CF_SYMLINK_TIMES;
#endif
#ifdef ICONV_OPTION
? strchr(client_info, 'L') != NULL
: !!(compat_flags & CF_SYMLINK_TIMES);
}
-#if defined HAVE_LUTIMES && defined HAVE_UTIMES
+#ifdef CAN_SET_SYMLINK_TIMES
else
receiver_symlink_times = 1;
#endif
exit_cleanup(RERR_SYNTAX);
}
need_messages_from_generator = 1;
-#if defined HAVE_LUTIMES && defined HAVE_UTIMES
+#ifdef CAN_SET_SYMLINK_TIMES
} else if (!am_sender) {
receiver_symlink_times = 1;
#endif
int unchanged_attrs(const char *fname, struct file_struct *file, stat_x *sxp)
{
-#if !defined HAVE_LUTIMES || !defined HAVE_UTIMES
+#ifndef CAN_SET_SYMLINK_TIMES
if (S_ISLNK(file->mode)) {
;
} else
if (statret >= 0) { /* A from-dest-dir statret can == 1! */
int keep_time = !preserve_times ? 0
: S_ISDIR(file->mode) ? preserve_times > 1 :
-#if defined HAVE_LUTIMES && defined HAVE_UTIMES
+#ifdef CAN_SET_SYMLINK_TIMES
1;
#else
!S_ISLNK(file->mode);
#ifdef ICONV_OPTION
iconv = "";
#endif
-#if defined HAVE_LUTIMES && defined HAVE_UTIMES
+#ifdef CAN_SET_SYMLINK_TIMES
symtimes = "";
#endif
argstr[x++] = '.';
if (allow_inc_recurse)
argstr[x++] = 'i';
-#if defined HAVE_LUTIMES && defined HAVE_UTIMES
+#ifdef CAN_SET_SYMLINK_TIMES
argstr[x++] = 'L';
#endif
#ifdef ICONV_OPTION
#include <utime.h>
#endif
+#ifdef HAVE_LUTIMES
+#define CAN_SET_SYMLINK_TIMES 1
+#endif
+
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
int set_modtime(const char *fname, time_t modtime, mode_t mode)
{
-#if !defined HAVE_LUTIMES || !defined HAVE_UTIMES
+#ifndef CAN_SET_SYMLINK_TIMES
if (S_ISLNK(mode))
return 1;
#endif
return 0;
{
-#ifdef HAVE_UTIMES
+#if defined HAVE_UTIMES || defined HAVE_LUTIMES
struct timeval t[2];
t[0].tv_sec = time(NULL);
t[0].tv_usec = 0;
t[1].tv_sec = modtime;
t[1].tv_usec = 0;
# ifdef HAVE_LUTIMES
- if (S_ISLNK(mode)) {
- if (lutimes(fname, t) < 0)
- return errno == ENOSYS ? 1 : -1;
- return 0;
- }
-# endif
+ if (lutimes(fname, t) < 0)
+ return S_ISLNK(mode) && errno == ENOSYS ? 1 : -1;
+ return 0;
+# else
return utimes(fname, t);
+# endif
#elif defined HAVE_STRUCT_UTIMBUF
struct utimbuf tbuf;
tbuf.actime = time(NULL);