]> granicus.if.org Git - php/commitdiff
MFB: fix #39651
authorNuno Lopes <nlopess@php.net>
Wed, 12 Sep 2007 11:46:08 +0000 (11:46 +0000)
committerNuno Lopes <nlopess@php.net>
Wed, 12 Sep 2007 11:46:08 +0000 (11:46 +0000)
ext/standard/proc_open.c

index af72b3bc215c6fd548a2b2c319ed82310a1e0e42..c1c733801149a7633740f7ffa1abf815c1f4d6e9 100644 (file)
@@ -669,6 +669,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