From: Nuno Lopes Date: Wed, 12 Sep 2007 11:42:43 +0000 (+0000) Subject: fix bug #39651: proc_open() append mode doesnt work on windows X-Git-Tag: php-5.2.5RC1~173 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b24d4ddac9a49e705b73fcd859afdd58bdbfde65;p=php fix bug #39651: proc_open() append mode doesnt work on windows --- diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c index 57dc02d9be..90585e3fc7 100644 --- a/ext/standard/proc_open.c +++ b/ext/standard/proc_open.c @@ -677,6 +677,12 @@ PHP_FUNCTION(proc_open) #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