com php-src: fix: phpdbg_list.c phpdbg_list.h phpdb g_prompt.c
| From: | Bob Weinand | Date: | Tue, 12 Nov 2013 02:29:56 +0000 |
| Subject: | com php-src: fix: phpdbg_list.c phpdbg_list.h phpdb g_prompt.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-75103@lists.php.net to get a copy of this message | ||
Commit: c7b51537a03734a3e0a8fbb9100840cd64a66d37
Author: krakjoe <joe.watkins@live.co.uk> Tue, 12 Nov 2013 02:29:56 +0000
Parents: d7e09f95646f74f47e2ff15f1ef9b78da2592dec
Branches: PHP-5.6
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=c7b51537a03734a3e0a8fbb9100840cd64a66d37
Log:
fix
Changed paths:
M phpdbg_list.c
M phpdbg_list.h
M phpdbg_prompt.c
Diff:
diff --git a/phpdbg_list.c b/phpdbg_list.c
index d460315..f4209e1 100644
--- a/phpdbg_list.c
+++ b/phpdbg_list.c
@@ -23,25 +23,26 @@
#include <sys/mman.h>
#include <unistd.h>
#include <fcntl.h>
+#include "phpdbg.h"
#include "phpdbg_list.h"
-void phpdbg_list_file(const char *filename, long count, long offset) /* {{{ */
+void phpdbg_list_file(const char *filename, long count, long offset TSRMLS_DC) /* {{{ */
{
unsigned char *mem, *pos, *last_pos, *end_pos;
struct stat st;
int fd, all_content = (count == 0);
unsigned int line = 0, displayed = 0;
- if ((fd = open(filename, O_RDONLY)) == -1) {
- printf("[Failed to open file %s to list]\n", filename);
- return;
- }
-
- if (fstat(fd, &st) == -1) {
+ if (VCWD_STAT(filename, &st) == -1) {
printf("[Failed to stat file %s]\n", filename);
goto out;
}
+ if ((fd = VCWD_OPEN(filename, O_RDONLY)) == -1) {
+ printf("[Failed to open file %s to list]\n", filename);
+ return;
+ }
+
last_pos = mem = mmap(0, st.st_size, PROT_READ, MAP_SHARED, fd, 0);
end_pos = mem + st.st_size;
diff --git a/phpdbg_list.h b/phpdbg_list.h
index 4531a65...883f991 100644
--- a/phpdbg_list.h
+++ b/phpdbg_list.h
@@ -20,6 +20,6 @@
#ifndef PHPDBG_LIST_H
#define PHPDBG_LIST_H
-void phpdbg_list_file(const char*, long, long);
+void phpdbg_list_file(const char*, long, long TSRMLS_DC);
#endif /* PHPDBG_LIST_H */
diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c
index fb6ba7c..c30d155 100644
--- a/phpdbg_prompt.c
+++ b/phpdbg_prompt.c
@@ -508,7 +508,7 @@ static PHPDBG_COMMAND(list) /* {{{ */
return SUCCESS;
}
- phpdbg_list_file(filename, count, offset);
+ phpdbg_list_file(filename, count, offset TSRMLS_CC);
return SUCCESS;
} /* }}} */