Skip to content

Commit c7b5153

Browse files
committed
fix
1 parent d7e09f9 commit c7b5153

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

phpdbg_list.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,26 @@
2323
#include <sys/mman.h>
2424
#include <unistd.h>
2525
#include <fcntl.h>
26+
#include "phpdbg.h"
2627
#include "phpdbg_list.h"
2728

28-
void phpdbg_list_file(const char *filename, long count, long offset) /* {{{ */
29+
void phpdbg_list_file(const char *filename, long count, long offset TSRMLS_DC) /* {{{ */
2930
{
3031
unsigned char *mem, *pos, *last_pos, *end_pos;
3132
struct stat st;
3233
int fd, all_content = (count == 0);
3334
unsigned int line = 0, displayed = 0;
3435

35-
if ((fd = open(filename, O_RDONLY)) == -1) {
36-
printf("[Failed to open file %s to list]\n", filename);
37-
return;
38-
}
39-
40-
if (fstat(fd, &st) == -1) {
36+
if (VCWD_STAT(filename, &st) == -1) {
4137
printf("[Failed to stat file %s]\n", filename);
4238
goto out;
4339
}
4440

41+
if ((fd = VCWD_OPEN(filename, O_RDONLY)) == -1) {
42+
printf("[Failed to open file %s to list]\n", filename);
43+
return;
44+
}
45+
4546
last_pos = mem = mmap(0, st.st_size, PROT_READ, MAP_SHARED, fd, 0);
4647
end_pos = mem + st.st_size;
4748

phpdbg_list.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@
2020
#ifndef PHPDBG_LIST_H
2121
#define PHPDBG_LIST_H
2222

23-
void phpdbg_list_file(const char*, long, long);
23+
void phpdbg_list_file(const char*, long, long TSRMLS_DC);
2424

2525
#endif /* PHPDBG_LIST_H */

phpdbg_prompt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ static PHPDBG_COMMAND(list) /* {{{ */
508508
return SUCCESS;
509509
}
510510

511-
phpdbg_list_file(filename, count, offset);
511+
phpdbg_list_file(filename, count, offset TSRMLS_CC);
512512

513513
return SUCCESS;
514514
} /* }}} */

0 commit comments

Comments
 (0)