From 8bf737494f17ca384b30db13b4bc31a5158f3646 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 1 Oct 1996 06:40:36 +0000 Subject: [PATCH] - check for sys/select.h - check for and use lchown if possible - fix problem with root directory on source and destination --- configure.in | 4 ++-- flist.c | 5 ++++- main.c | 2 ++ rsync.c | 6 +++--- rsync.h | 8 ++++++++ version.h | 2 +- 6 files changed, 20 insertions(+), 7 deletions(-) diff --git a/configure.in b/configure.in index 76f3ed58..4ab86353 100644 --- a/configure.in +++ b/configure.in @@ -13,7 +13,7 @@ AC_DEFINE_UNQUOTED(HAVE_REMSH, $HAVE_REMSH) AC_HEADER_DIRENT AC_HEADER_TIME AC_HEADER_SYS_WAIT -AC_CHECK_HEADERS(sys/fcntl.h fcntl.h sys/time.h sys/unistd.h unistd.h utime.h grp.h) +AC_CHECK_HEADERS(sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h unistd.h utime.h grp.h) AC_CHECK_HEADERS(compat.h sys/param.h ctype.h sys/wait.h sys/ioctl.h) AC_CHECK_HEADERS(sys/filio.h string.h stdlib.h) @@ -42,7 +42,7 @@ AC_FUNC_MMAP AC_FUNC_UTIME_NULL AC_CHECK_FUNCS(waitpid strtok pipe getcwd mkdir strdup strerror chown chmod mknod) AC_CHECK_FUNCS(fchmod fstat strchr bcopy bzero readlink link utime utimes) -AC_CHECK_FUNCS(memmove getopt_long) +AC_CHECK_FUNCS(memmove getopt_long lchown) echo $ac_n "checking for working fnmatch... $ac_c" AC_TRY_RUN([#include diff --git a/flist.c b/flist.c index 80f18e48..59e451b1 100644 --- a/flist.c +++ b/flist.c @@ -424,7 +424,10 @@ struct file_list *send_file_list(int f,int argc,char *argv[]) p = strrchr(fname,'/'); if (p) { *p = 0; - dir = fname; + if (p == fname) + dir = "/"; + else + dir = fname; fname = p+1; } if (!*fname) diff --git a/main.c b/main.c index 8ca252fb..3cbf5f8a 100644 --- a/main.c +++ b/main.c @@ -294,6 +294,8 @@ void do_server_sender(int argc,char *argv[]) if (strcmp(dir,".")) { int l = strlen(dir); + if (strcmp(dir,"/") == 0) + l = 0; for (i=0;ist_uid != file->uid) || (preserve_gid && st->st_gid != file->gid)) { updated = 1; - if (chown(fname, - (am_root&&preserve_uid)?file->uid:-1, - preserve_gid?file->gid:-1) != 0) { + if (lchown(fname, + (am_root&&preserve_uid)?file->uid:-1, + preserve_gid?file->gid:-1) != 0) { if (verbose>1 || preserve_uid) fprintf(FERROR,"chown %s : %s\n",fname,strerror(errno)); return updated; diff --git a/rsync.h b/rsync.h index 6e7210cf..34792fc9 100644 --- a/rsync.h +++ b/rsync.h @@ -136,6 +136,10 @@ #include #endif +#ifdef HAVE_SYS_SELECT_H +#include +#endif + #ifdef HAVE_FNMATCH #include #else @@ -283,6 +287,10 @@ extern int errno; #define lstat stat #endif +#ifndef HAVE_LCHOWN +#define lchown chown +#endif + #define SIGNAL_CAST (RETSIGTYPE (*)()) #ifndef EWOULDBLOCK diff --git a/version.h b/version.h index 452e8c61..e7efd901 100644 --- a/version.h +++ b/version.h @@ -1 +1 @@ -#define VERSION "1.6.0" +#define VERSION "1.6.1" -- 2.34.1