summaryrefslogtreecommitdiff
path: root/src/win32/posix.h
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2012-11-14 22:41:51 -0800
committerRussell Belfer <rb@github.com>2012-11-14 22:41:51 -0800
commitcccacac555ed3937204f8dfd397bc92e499d2c42 (patch)
treef2dbc74e6a27f330156d94e407307a954d6cbb37 /src/win32/posix.h
parenta277345e05507dfa0a3350d47df96d37063c929f (diff)
downloadlibgit2-cccacac555ed3937204f8dfd397bc92e499d2c42.tar.gz
Add POSIX compat lstat() variant for win32
The existing p_lstat implementation on win32 is not quite POSIX compliant when setting errno to ENOTDIR. This adds an option to make is be compliant so that code (such as checkout) that cares to have separate behavior for ENOTDIR can use it portably. This also contains a couple of other minor cleanups in the posix_w32.c implementations to avoid unnecessary work.
Diffstat (limited to 'src/win32/posix.h')
-rw-r--r--src/win32/posix.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/win32/posix.h b/src/win32/posix.h
index d99864d05..ee61c2d05 100644
--- a/src/win32/posix.h
+++ b/src/win32/posix.h
@@ -50,4 +50,12 @@ extern int p_recv(GIT_SOCKET socket, void *buffer, size_t length, int flags);
extern int p_send(GIT_SOCKET socket, const void *buffer, size_t length, int flags);
extern int p_inet_pton(int af, const char* src, void* dst);
+/* p_lstat is almost but not quite POSIX correct. Specifically, the use of
+ * ENOTDIR is wrong, in that it does not mean precisely that a non-directory
+ * entry was encountered. Making it correct is potentially expensive,
+ * however, so this is a separate version of p_lstat to use when correct
+ * POSIX ENOTDIR semantics is required.
+ */
+extern int p_lstat_posixly(const char *filename, struct stat *buf);
+
#endif