com php-src: fix mmap in windows: phpdbg_list.c

From: Date: Sun, 17 Nov 2013 23:48:07 +0000
Subject: com php-src: fix mmap in windows: phpdbg_list.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-74867@lists.php.net to get a copy of this message
Commit: 0966cad65159e00e57b049edcb9f66aed30e5396 Author: Joe Watkins <joe.watkins@live.co.uk> Sun, 17 Nov 2013 23:48:07 +0000 Parents: ff2abccc4bb50e4a9a59315327c577acf1b7202e Branches: PHP-5.6 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=0966cad65159e00e57b049edcb9f66aed30e5396 Log: fix mmap in windows fix mmap in windows Changed paths: M phpdbg_list.c Diff: diff --git a/phpdbg_list.c b/phpdbg_list.c index 0770bab..dcce374 100644 --- a/phpdbg_list.c +++ b/phpdbg_list.c @@ -142,7 +142,7 @@ void phpdbg_list_file(const char *filename, long count, long offset, int highlig int all_content = (count == 0); unsigned int line = 0, displayed = 0; - if (VCWD_STAT(filename, &st) == FAILURE) { + if (VCWD_STAT(filename, &st) == FAILURE) { phpdbg_error("Failed to stat file %s", filename); return; } @@ -156,13 +156,14 @@ void phpdbg_list_file(const char *filename, long count, long offset, int highlig last_pos = mem = mmap(0, st.st_size, PROT_READ, MAP_SHARED, fd, 0); end_pos = mem + st.st_size; #else - fd = CreateFile(filename, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL); + + fd = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (fd == INVALID_HANDLE_VALUE) { phpdbg_error("Failed to open file!"); return; } - map = CreateFileMapping(fd, NULL, PAGE_EXECUTE_READ, 0, 0, 0); + map = CreateFileMapping(fd, NULL, PAGE_READONLY, 0, 0, NULL); if (map == NULL) { phpdbg_error("Failed to map file!"); CloseHandle(fd);

« previous php.cvs (#74867) next »