|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
Patch kill-tmpnam-usage.patch for phpdbg Bug #66591Patch version 2014-01-28 11:37 UTC Return to Bug #66591 | Download this patchThis patch renders other patches obsolete Obsolete patches: Patch Revisions:Developer: ondrej@php.net
--- php5.orig/sapi/phpdbg/phpdbg.c
+++ php5/sapi/phpdbg/phpdbg.c
@@ -871,11 +871,26 @@ int main(int argc, char **argv) /* {{{ *
phpdbg_main:
if (!cleaning) {
- bp_tmp_file = malloc(L_tmpnam);
- tmpnam(bp_tmp_file);
+ int tfd = -1;
+ bp_tmp_file = strdup("/tmp/phpdbg.XXXXXX");
if (bp_tmp_file == NULL) {
phpdbg_error("Unable to create temporary file");
}
+#ifndef HAVE_MKSTEMP
+ {
+ char *ptr = mktemp(bp_tmp_file);
+ tfd = open(ptr, O_RDWR|O_TRUNC|O_EXCL|O_CREAT, 0600);
+ }
+#else
+ {
+ tfd = mkstemp(bp_tmp_file);
+ }
+#endif
+ if (tfd == -1) {
+ phpdbg_error("Unable to create temporary file");
+ } else {
+ close(tfd);
+ }
}
ini_entries = NULL;
ini_entries_len = 0;
|
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 03:00:02 2025 UTC |