com php-src: ...: phpdbg.c
| From: | Bob Weinand | Date: | Sun, 02 Feb 2014 14:41:51 +0000 |
| Subject: | com php-src: ...: phpdbg.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-77091@lists.php.net to get a copy of this message | ||
Commit: 0c94f8a8934211694bab200507786248185e2dfd
Author: krakjoe <joe.watkins@live.co.uk> Sun, 2 Feb 2014 14:41:51 +0000
Parents: e55bd70643d9e9c8b3f0a6d141dc2ca3d0ef024c
Branches: PHP-5.6
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=0c94f8a8934211694bab200507786248185e2dfd
Log:
..
Changed paths:
M phpdbg.c
Diff:
diff --git a/phpdbg.c b/phpdbg.c
index 2a10ada..9341ad3 100644
--- a/phpdbg.c
+++ b/phpdbg.c
@@ -833,7 +833,7 @@ int main(int argc, char **argv) /* {{{ */
int step = 0;
#ifdef _WIN32
- char *bp_tmp_file;
+ char *bp_tmp_file = NULL;
#else
char bp_tmp_file[] = "/tmp/phpdbg.XXXXXX";
#endif
@@ -877,14 +877,23 @@ int main(int argc, char **argv) /* {{{ */
phpdbg_main:
if (!cleaning) {
+
#ifdef _WIN32
bp_tmp_file = malloc(L_tmpnam);
- tmpnam(bp_tmp_file);
+ if (bp_tmp_file) {
+ if (!tmpnam(bp_tmp_file)) {
+ free(bp_tmp_file);
+ bp_tmp_file = NULL;
+ }
+ }
#else
- mkstemp(bp_tmp_file);
+ if (!mkstemp(bp_tmp_file)) {
+ memset(bp_tmp_file, 0, sizeof(bp_tmp_file));
+ }
#endif
- if (bp_tmp_file == NULL) {
+
+ if (!bp_tmp_file) {
phpdbg_error("Unable to create temporary file");
}
}