]> granicus.if.org Git - php/commitdiff
fix
authorkrakjoe <joe.watkins@live.co.uk>
Tue, 12 Nov 2013 02:29:56 +0000 (02:29 +0000)
committerkrakjoe <joe.watkins@live.co.uk>
Tue, 12 Nov 2013 02:29:56 +0000 (02:29 +0000)
phpdbg_list.c
phpdbg_list.h
phpdbg_prompt.c

index d4603155312025593f666f12f23ffa3fa83ba645..f4209e12198ff9f7dbea452ab24bea8461e57aaa 100644 (file)
 #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;
 
index 4531a65d106457f4c398b49a1bca48d1762f3798..883f9917f1bb8f49c88b171259ca68bf827be688 100644 (file)
@@ -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 */
index fb6ba7cebc1843d91921e64137014ac481be4a92..c30d15589b5d44f084203d900cd4d75d2c950651 100644 (file)
@@ -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;
 } /* }}} */