summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.in2
-rw-r--r--configure.in9
-rw-r--r--rsync.h16
-rw-r--r--util.c13
4 files changed, 27 insertions, 13 deletions
diff --git a/Makefile.in b/Makefile.in
index ce49f976..ed0a86a4 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -20,7 +20,7 @@ SHELL=/bin/sh
.SUFFIXES:
.SUFFIXES: .c .o
-LIBOBJ=lib/getopt.o lib/fnmatch.o lib/zlib.o
+LIBOBJ=lib/getopt.o lib/fnmatch.o lib/zlib.o lib/compat.o
OBJS1=rsync.o exclude.o util.o md4.o main.o checksum.o match.o
OBJS=$(OBJS1) flist.o io.o compat.o hlink.o token.o uidlist.o $(LIBOBJ)
diff --git a/configure.in b/configure.in
index ade21982..cc161e7c 100644
--- a/configure.in
+++ b/configure.in
@@ -52,4 +52,13 @@ main() { exit(fnmatch("*.o", "x.o", 0) == 0? 0: 1); }],
echo yes;AC_DEFINE(HAVE_FNMATCH),
echo no)
+echo $ac_n "checking for utimbuf ... $ac_c"
+AC_TRY_COMPILE([#include <sys/types.h>
+#include <utime.h>],
+[int set_modtime(char *fname,time_t modtime)
+{ struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = modtime;
+ return utime(fname,&tbuf); }],
+echo yes;AC_DEFINE(HAVE_UTIMBUF),
+echo no)
+
AC_OUTPUT(Makefile)
diff --git a/rsync.h b/rsync.h
index 836c67d6..cef172a1 100644
--- a/rsync.h
+++ b/rsync.h
@@ -333,5 +333,21 @@ extern int errno;
#define S_IWUSR 0200
#endif
+#ifndef S_ISBLK
+#define S_ISBLK(mode) (((mode) & (_S_IFMT)) == (_S_IFBLK))
+#endif
+
+#ifndef S_ISCHR
+#define S_ISCHR(mode) (((mode) & (_S_IFMT)) == (_S_IFCHR))
+#endif
+
+#ifndef S_ISDIR
+#define S_ISDIR(mode) (((mode) & (_S_IFMT)) == (_S_IFDIR))
+#endif
+
+#ifndef S_ISREG
+#define S_ISREG(mode) (((mode) & (_S_IFMT)) == (_S_IFREG))
+#endif
+
#define IS_DEVICE(mode) (S_ISCHR(mode) || S_ISBLK(mode))
diff --git a/util.c b/util.c
index d04a2173..2a479458 100644
--- a/util.c
+++ b/util.c
@@ -164,21 +164,10 @@ void out_of_memory(char *str)
}
-#ifndef HAVE_STRDUP
- char *strdup(char *s)
-{
- int l = strlen(s) + 1;
- char *ret = (char *)malloc(l);
- if (ret)
- strcpy(ret,s);
- return ret;
-}
-#endif
-
int set_modtime(char *fname,time_t modtime)
{
-#ifdef HAVE_UTIME_H
+#ifdef HAVE_UTIMBUF
struct utimbuf tbuf;
tbuf.actime = time(NULL);
tbuf.modtime = modtime;