]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Fix bsdcpio build on VS9. There's still a minor build issue on MinGW that I need...
authorTim Kientzle <kientzle@gmail.com>
Thu, 6 Aug 2009 05:29:00 +0000 (01:29 -0400)
committerTim Kientzle <kientzle@gmail.com>
Thu, 6 Aug 2009 05:29:00 +0000 (01:29 -0400)
SVN-Revision: 1349

cpio/cpio_windows.c
cpio/cpio_windows.h

index 69df6985fa7e78739eadcf9a93b74add7a28f8e7..25c77cda0f711e5344a29861361c32416dced1ba 100644 (file)
@@ -492,7 +492,7 @@ la_open(const char *path, int flags, ...)
        pmode = va_arg(ap, int);
        va_end(ap);
        ws = NULL;
-       if ((flags & ~O_BINARY) == O_RDONLY) {
+       if ((flags & ~_O_BINARY) == _O_RDONLY) {
                /*
                 * When we open a directory, _open function returns 
                 * "Permission denied" error.
@@ -622,26 +622,6 @@ la_read(int fd, void *buf, size_t nbytes)
        return ((ssize_t)bytes_read);
 }
 
-/* Remove directory */
-int
-la_rmdir(const char *path)
-{
-       wchar_t *ws;
-       int r;
-
-       r = _rmdir(path);
-       if (r >= 0 || errno != ENOENT)
-               return (r);
-       ws = permissive_name(path);
-       if (ws == NULL) {
-               errno = EINVAL;
-               return (-1);
-       }
-       r = _wrmdir(ws);
-       free(ws);
-       return (r);
-}
-
 /* Convert Windows FILETIME to UTC */
 __inline static void
 fileTimeToUTC(const FILETIME *filetime, time_t *time, long *ns)
@@ -693,7 +673,7 @@ __hstat(HANDLE handle, struct ustat *st)
                } else {
                        DWORD avail;
 
-                       st->st_mode = S_IFIFO;
+                       st->st_mode = AE_IFIFO;
                        if (PeekNamedPipe(handle, NULL, 0, NULL, &avail, NULL))
                                st->st_size = avail;
                        else
@@ -797,7 +777,8 @@ la_fstat(int fd, struct stat *st)
        ret = __hstat((HANDLE)_get_osfhandle(fd), &u);
        if (ret >= 0) {
                copy_stat(st, &u);
-               if (u.st_mode & (S_IFCHR | S_IFIFO)) {
+               if ((u.st_mode & AE_IFMT) == AE_IFCHR
+                       || (u.st_mode & AE_IFMT) == AE_IFIFO) {
                        st->st_dev = fd;
                        st->st_rdev = fd;
                }
@@ -869,7 +850,7 @@ la_write(int fd, const void *buf, size_t nbytes)
        return (bytes_written);
 }
 
-#endif
+//#endif
 /*
  * The following function was modified from PostgreSQL sources and is
  * subject to the copyright below.
@@ -986,3 +967,4 @@ cpio_dosmaperr(unsigned long e)
        errno = EINVAL;
        return;
 }
+#endif
index b1d94d437d28ef9dd4449a0d9c664710bcfc7000..9b44764c193a7f78f6456297ef65f57f5eba92f8 100644 (file)
  *
  * $FreeBSD$
  */
-
 #ifndef CPIO_WINDOWS_H
 #define CPIO_WINDOWS_H 1
 
-#include <direct.h>
 #include <io.h>
 
 #define getgrgid(id)   NULL
@@ -38,6 +36,7 @@
 
 #ifdef _MSC_VER
 #define snprintf       sprintf_s
+#define strdup         _strdup
 #endif
 
 struct passwd {
@@ -51,4 +50,19 @@ struct group {
        gid_t    gr_gid;
 };
 
+struct _timeval64i32 {
+       time_t          tv_sec;
+       long            tv_usec;
+};
+#define __timeval _timeval64i32
+
+extern int futimes(int fd, const struct __timeval *times);
+#ifndef HAVE_FUTIMES
+#define HAVE_FUTIMES 1
+#endif
+extern int utimes(const char *name, const struct __timeval *times);
+#ifndef HAVE_UTIMES
+#define HAVE_UTIMES 1
+#endif
+
 #endif /* CPIO_WINDOWS_H */