php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #61566
Patch 61566.diff revision 2012-04-02 15:07 UTC by ab@php.net
revision 2012-04-02 12:58 UTC by ab@php.net
revision 2012-03-31 10:02 UTC by ab@php.net

Patch 61566.diff for *Directory/Filesystem functions Bug #61566

Patch version 2012-04-02 12:58 UTC

Return to Bug #61566 | Download this patch
This patch renders other patches obsolete

Obsolete patches:

Patch Revisions:

Developer: ab@php.net

diff --git a/ext/fileinfo/libmagic/cdf.c b/ext/fileinfo/libmagic/cdf.c
index 1f0f63b..7efa43e 100644
--- a/ext/fileinfo/libmagic/cdf.c
+++ b/ext/fileinfo/libmagic/cdf.c
@@ -306,10 +306,10 @@ cdf_read(const cdf_info_t *info, off_t off, void *buf, size_t len)
 	if (info->i_fd == -1)
 		return -1;
 
-	if (lseek(info->i_fd, off, SEEK_SET) == (off_t)-1)
+	if (FINFO_LSEEK_FUNC(info->i_fd, off, SEEK_SET) == (off_t)-1)
 		return -1;
 
-	if (read(info->i_fd, buf, len) != (ssize_t)len)
+	if (FINFO_READ_FUNC(info->i_fd, buf, len) != (ssize_t)len)
 		return -1;
 
 	return (ssize_t)len;
diff --git a/ext/fileinfo/libmagic/file.h b/ext/fileinfo/libmagic/file.h
index b73c9b1..e1269ae 100644
--- a/ext/fileinfo/libmagic/file.h
+++ b/ext/fileinfo/libmagic/file.h
@@ -486,4 +486,12 @@ static const char *rcsid(const char *p) { \
 #define FILE_RCSID(id)
 #endif
 
+#ifdef PHP_WIN32
+#define FINFO_LSEEK_FUNC _lseek
+#define FINFO_READ_FUNC _read
+#else
+#define FINFO_LSEEK_FUNC lseek
+#define FINFO_READ_FUNC read
+#endif
+
 #endif /* __file_h__ */
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Nov 23 10:01:28 2024 UTC