From: Tim Kientzle Date: Thu, 6 Aug 2009 05:29:00 +0000 (-0400) Subject: Fix bsdcpio build on VS9. There's still a minor build issue on MinGW that I need... X-Git-Tag: v2.8.0~439 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5b48250aca6415c538f81a4eb167c6c9b2741797;p=thirdparty%2Flibarchive.git Fix bsdcpio build on VS9. There's still a minor build issue on MinGW that I need to track down. I think some of the cpio_windows.c shims aren't needed and can be removed. SVN-Revision: 1349 --- diff --git a/cpio/cpio_windows.c b/cpio/cpio_windows.c index 69df6985f..25c77cda0 100644 --- a/cpio/cpio_windows.c +++ b/cpio/cpio_windows.c @@ -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 diff --git a/cpio/cpio_windows.h b/cpio/cpio_windows.h index b1d94d437..9b44764c1 100644 --- a/cpio/cpio_windows.h +++ b/cpio/cpio_windows.h @@ -24,11 +24,9 @@ * * $FreeBSD$ */ - #ifndef CPIO_WINDOWS_H #define CPIO_WINDOWS_H 1 -#include #include #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 */