- check for sys/select.h
authorAndrew Tridgell <tridge@samba.org>
Tue, 1 Oct 1996 06:40:36 +0000 (06:40 +0000)
committerAndrew Tridgell <tridge@samba.org>
Tue, 1 Oct 1996 06:40:36 +0000 (06:40 +0000)
- check for and use lchown if possible

- fix problem with root directory on source and destination

configure.in
flist.c
main.c
rsync.c
rsync.h
version.h

index 76f3ed5..4ab8635 100644 (file)
@@ -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 <fnmatch.h>
diff --git a/flist.c b/flist.c
index 80f18e4..59e451b 100644 (file)
--- 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 8ca252f..3cbf5f8 100644 (file)
--- 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;i<argc;i++)
       argv[i] += l+1;
   }
diff --git a/rsync.c b/rsync.c
index bcb101a..b19681c 100644 (file)
--- a/rsync.c
+++ b/rsync.c
@@ -234,9 +234,9 @@ static int set_perms(char *fname,struct file_struct *file,struct stat *st,
   if ((am_root && preserve_uid && st->st_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 6e7210c..34792fc 100644 (file)
--- a/rsync.h
+++ b/rsync.h
 #include <utime.h>
 #endif
 
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+
 #ifdef HAVE_FNMATCH
 #include <fnmatch.h>
 #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
index 452e8c6..e7efd90 100644 (file)
--- a/version.h
+++ b/version.h
@@ -1 +1 @@
-#define VERSION "1.6.0"
+#define VERSION "1.6.1"