nlopess Wed Sep 12 11:42:43 2007 UTC
Modified files: (Branch: PHP_5_2)
/php-src/ext/standard proc_open.c
Log:
fix bug #39651: proc_open() append mode doesnt work on windows
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/proc_open.c?r1=1.36.2.1.2.16&r2=1.36.2.1.2.17&diff_format=u
Index: php-src/ext/standard/proc_open.c
diff -u php-src/ext/standard/proc_open.c:1.36.2.1.2.16
php-src/ext/standard/proc_open.c:1.36.2.1.2.17
--- php-src/ext/standard/proc_open.c:1.36.2.1.2.16 Fri Aug 17 10:42:30 2007
+++ php-src/ext/standard/proc_open.c Wed Sep 12 11:42:43 2007
@@ -15,7 +15,7 @@
| Author: Wez Furlong <[EMAIL PROTECTED]> |
+----------------------------------------------------------------------+
*/
-/* $Id: proc_open.c,v 1.36.2.1.2.16 2007/08/17 10:42:30 jani Exp $ */
+/* $Id: proc_open.c,v 1.36.2.1.2.17 2007/09/12 11:42:43 nlopess Exp $ */
#if 0 && (defined(__linux__) || defined(sun) || defined(__IRIX__))
# define _BSD_SOURCE /* linux wants this when XOPEN mode is on */
@@ -677,6 +677,12 @@
#ifdef PHP_WIN32
descriptors[ndesc].childend =
dup_fd_as_handle(fd);
_close(fd);
+
+ /* simulate the append mode by fseeking to the
end of the file
+ this introduces a potential race-condition, but
it is the best we can do, though */
+ if (strchr(Z_STRVAL_PP(zmode), 'a')) {
+
SetFilePointer(descriptors[ndesc].childend, 0, NULL, FILE_END);
+ }
#else
descriptors[ndesc].childend = fd;
#endif
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php