Skip to content

Commit 261a530

Browse files
committed
fix bugsnet #66591 and github #60
1 parent c768abd commit 261a530

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

phpdbg.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,13 @@ int main(int argc, char **argv) /* {{{ */
831831
zend_bool remote = 0;
832832
int run = 0;
833833
int step = 0;
834+
835+
#ifdef _WIN32
834836
char *bp_tmp_file;
837+
#else
838+
char bp_tmp_file[] = "/tmp/phpdbg.XXXXXX";
839+
#endif
840+
835841
#ifndef _WIN32
836842
char *address;
837843
int listen[2];
@@ -871,8 +877,12 @@ int main(int argc, char **argv) /* {{{ */
871877

872878
phpdbg_main:
873879
if (!cleaning) {
880+
#ifdef _WIN32
874881
bp_tmp_file = malloc(L_tmpnam);
875882
tmpnam(bp_tmp_file);
883+
#else
884+
mkstemp(bp_tmp_file);
885+
#endif
876886
if (bp_tmp_file == NULL) {
877887
phpdbg_error("Unable to create temporary file");
878888
}
@@ -1342,7 +1352,11 @@ int main(int argc, char **argv) /* {{{ */
13421352
free(sapi_name);
13431353
}
13441354

1355+
#ifdef _WIN32
13451356
free(bp_tmp_file);
1357+
#else
1358+
unlink(bp_tmp_file);
1359+
#endif
13461360

13471361
return 0;
13481362
} /* }}} */

0 commit comments

Comments
 (0)