]> arthur.barton.de Git - netatalk.git/commitdiff
Portability fixes
authorFrank Lahm <franklahm@googlemail.com>
Thu, 14 Oct 2010 09:14:47 +0000 (11:14 +0200)
committerFrank Lahm <franklahm@googlemail.com>
Thu, 14 Oct 2010 09:14:47 +0000 (11:14 +0200)
bin/ad/ad.h
bin/ad/ad_cp.c

index b8941e691db9e9292dcef962c7cc4dab46211bdb..53869e0de314b6af71d1c0d74f7c897775b3d16d 100644 (file)
 #define DIR_DOT_OR_DOTDOT(a) \
         ((strcmp(a, ".") == 0) || (strcmp(a, "..") == 0))
 
+#ifndef TIMESPEC_TO_TIMEVAL
+#define TIMESPEC_TO_TIMEVAL(tv, ts) { \
+    (tv)->tv_sec = (ts)->tv_sec; \
+    (tv)->tv_usec = (ts)->tv_nsec / 1000; \
+    }
+#endif
+
 enum logtype {STD, DBG};
 
 #define SLOG(...)                             \
index b7596fdfb38eede6f245fda9e263068ebed45dda..15fc3ba509face9ac43db871ee8a8943713357c3 100644 (file)
@@ -59,6 +59,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <libgen.h>
 
 #include <atalk/ftw.h>
 #include <atalk/adouble.h>
@@ -829,8 +830,8 @@ static int setfile(const struct stat *fs, int fd)
 
     TIMESPEC_TO_TIMEVAL(&tv[0], &fs->st_atim);
     TIMESPEC_TO_TIMEVAL(&tv[1], &fs->st_mtim);
-    if (islink ? lutimes(to.p_path, tv) : utimes(to.p_path, tv)) {
-        SLOG("%sutimes: %s", islink ? "l" : "", to.p_path);
+    if (utimes(to.p_path, tv)) {
+        SLOG("utimes: %s", to.p_path);
         rval = 1;
     }
     if (fdval ? fstat(fd, &ts) :