diff options
author | kinichiro <kinichiro.inoguchi@gmail.com> | 2018-03-18 00:38:14 +0900 |
---|---|---|
committer | kinichiro <kinichiro.inoguchi@gmail.com> | 2018-03-18 00:48:49 +0900 |
commit | 1fb8c9c6bea797e4db5e395fb34b899682ee8682 (patch) | |
tree | ed17143c8278e688db9f0eace525c23ac96c58e7 /tls | |
parent | 639a6629ae4b2243d1d15670f90750c3200ff4bf (diff) | |
download | portable-1fb8c9c6bea797e4db5e395fb34b899682ee8682.tar.gz portable-1fb8c9c6bea797e4db5e395fb34b899682ee8682.tar.bz2 portable-1fb8c9c6bea797e4db5e395fb34b899682ee8682.zip |
Fix using right functions for file descriptor with MS Visual Studio
Diffstat (limited to 'tls')
-rw-r--r-- | tls/compat/ftruncate.c | 4 | ||||
-rw-r--r-- | tls/compat/getuid.c | 4 | ||||
-rw-r--r-- | tls/compat/pread.c | 6 | ||||
-rw-r--r-- | tls/compat/pwrite.c | 6 |
4 files changed, 20 insertions, 0 deletions
diff --git a/tls/compat/ftruncate.c b/tls/compat/ftruncate.c index e68e6d0..e825e50 100644 --- a/tls/compat/ftruncate.c +++ b/tls/compat/ftruncate.c | |||
@@ -4,6 +4,8 @@ | |||
4 | * Kinichiro Inoguchi <inoguchi@openbsd.org> | 4 | * Kinichiro Inoguchi <inoguchi@openbsd.org> |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #ifdef _WIN32 | ||
8 | |||
7 | #include <unistd.h> | 9 | #include <unistd.h> |
8 | 10 | ||
9 | int | 11 | int |
@@ -11,3 +13,5 @@ ftruncate(int fd, off_t length) | |||
11 | { | 13 | { |
12 | return _chsize(fd, length); | 14 | return _chsize(fd, length); |
13 | } | 15 | } |
16 | |||
17 | #endif | ||
diff --git a/tls/compat/getuid.c b/tls/compat/getuid.c index 632967a..9a46317 100644 --- a/tls/compat/getuid.c +++ b/tls/compat/getuid.c | |||
@@ -4,6 +4,8 @@ | |||
4 | * Kinichiro Inoguchi <inoguchi@openbsd.org> | 4 | * Kinichiro Inoguchi <inoguchi@openbsd.org> |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #ifdef _WIN32 | ||
8 | |||
7 | #include <unistd.h> | 9 | #include <unistd.h> |
8 | 10 | ||
9 | uid_t | 11 | uid_t |
@@ -12,3 +14,5 @@ getuid(void) | |||
12 | /* Windows fstat sets 0 as st_uid */ | 14 | /* Windows fstat sets 0 as st_uid */ |
13 | return 0; | 15 | return 0; |
14 | } | 16 | } |
17 | |||
18 | #endif | ||
diff --git a/tls/compat/pread.c b/tls/compat/pread.c index f0c9a2f..b9d6b09 100644 --- a/tls/compat/pread.c +++ b/tls/compat/pread.c | |||
@@ -4,6 +4,10 @@ | |||
4 | * Kinichiro Inoguchi <inoguchi@openbsd.org> | 4 | * Kinichiro Inoguchi <inoguchi@openbsd.org> |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #ifdef _WIN32 | ||
8 | |||
9 | #define NO_REDEF_POSIX_FUNCTIONS | ||
10 | |||
7 | #include <unistd.h> | 11 | #include <unistd.h> |
8 | 12 | ||
9 | ssize_t | 13 | ssize_t |
@@ -21,3 +25,5 @@ pread(int d, void *buf, size_t nbytes, off_t offset) | |||
21 | return -1; | 25 | return -1; |
22 | return bytes; | 26 | return bytes; |
23 | } | 27 | } |
28 | |||
29 | #endif | ||
diff --git a/tls/compat/pwrite.c b/tls/compat/pwrite.c index a304f7a..82f5f55 100644 --- a/tls/compat/pwrite.c +++ b/tls/compat/pwrite.c | |||
@@ -4,6 +4,10 @@ | |||
4 | * Kinichiro Inoguchi <inoguchi@openbsd.org> | 4 | * Kinichiro Inoguchi <inoguchi@openbsd.org> |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #ifdef _WIN32 | ||
8 | |||
9 | #define NO_REDEF_POSIX_FUNCTIONS | ||
10 | |||
7 | #include <unistd.h> | 11 | #include <unistd.h> |
8 | 12 | ||
9 | ssize_t | 13 | ssize_t |
@@ -21,3 +25,5 @@ pwrite(int d, const void *buf, size_t nbytes, off_t offset) | |||
21 | return -1; | 25 | return -1; |
22 | return bytes; | 26 | return bytes; |
23 | } | 27 | } |
28 | |||
29 | #endif | ||