cvs: pecl /inclued inclued.c
| From: | Gopal Vijayaraghavan | Date: | Thu, 30 Oct 2008 17:56:46 +0000 |
| Subject: | cvs: pecl /inclued inclued.c | ||
| Groups: | php.pecl.cvs | ||
| Request: | Send a blank email to pecl-cvs+get-11469@lists.php.net to get a copy of this message | ||
gopalv Thu Oct 30 17:56:46 2008 UTC
Modified files:
/pecl/inclued inclued.c
Log:
use mkstemp() to generate dump file names for threaded php builds
http://cvs.php.net/viewvc.cgi/pecl/inclued/inclued.c?r1=1.5&r2=1.6&diff_format=u
Index: pecl/inclued/inclued.c
diff -u pecl/inclued/inclued.c:1.5 pecl/inclued/inclued.c:1.6
--- pecl/inclued/inclued.c:1.5 Mon Aug 25 14:41:01 2008
+++ pecl/inclued/inclued.c Thu Oct 30 17:56:46 2008
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: inclued.c,v 1.5 2008/08/25 14:41:01 gopalv Exp $ */
+/* $Id: inclued.c,v 1.6 2008/10/30 17:56:46 gopalv Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -254,21 +254,37 @@
{
char path[MAXPATHLEN];
FILE *dumpfile;
+#ifdef ZTS
+ int dumpfd;
+#endif
smart_str buf = {0};
php_serialize_data_t var_hash;
zval retval;
zval *pretval = &retval;
if(INCLUED_G(enabled) && INCLUED_G(dumpdir) && INCLUED_G(dumpdir)[0] !=
'\0') {
+
+#ifndef ZTS
snprintf(path, MAXPATHLEN, "%s" DEFAULT_SLASH_STRING "inclued.%05d.%d",
INCLUED_G(dumpdir),
getpid(), INCLUED_G(counter));
if(!(dumpfile = fopen(path, "w"))) {
- zend_error(E_WARNING, "cannot write to %s" DEFAULT_SLASH_STRING,
- INCLUED_G(dumpdir));
+ zend_error(E_WARNING, "cannot write to %s", path);
return SUCCESS;
}
+#else
+ snprintf(path, MAXPATHLEN, "%s" DEFAULT_SLASH_STRING "inclued.XXXXXX",
+ INCLUED_G(dumpdir));
+
+ if((dumpfd = mkstemp(path)) == -1) {
+ zend_error(E_WARNING, "cannot write to %s", path);
+ return SUCCESS;
+ }
+
+ dumpfile = fdopen(dumpfd, "w");
+ close(dumpfd);
+#endif
pack_output(pretval TSRMLS_CC);