summaryrefslogtreecommitdiff
path: root/os_dep.c
diff options
context:
space:
mode:
authorivmai <ivmai>2011-03-22 17:50:16 +0000
committerIvan Maidanski <ivmai@mail.ru>2011-07-26 21:06:57 +0400
commit2de7add91598ef5ba24e869c15b4003bc57819b1 (patch)
tree2640539b96ce5b77bb8a437a1e968a1cd92dd959 /os_dep.c
parentad269687a9cb0d834eed41ad67c9c4acbad205c9 (diff)
downloadbdwgc-2de7add91598ef5ba24e869c15b4003bc57819b1.tar.gz
2011-03-22 Ivan Maidanski <ivmai@mail.ru>
* misc.c (GC_abort): Use _exit() (instead of DebugBreak) on Win32 when doing code static analysis (to inform the tool that the function is a no-return one). * os_dep.c (GC_linux_stack_base): Remove a duplicate validation of the length of "stat" file; use signed int type for "i", "buf_offset" and "len" local variables (since read() may return -1).
Diffstat (limited to 'os_dep.c')
-rw-r--r--os_dep.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/os_dep.c b/os_dep.c
index c876a09d..bc53d7ce 100644
--- a/os_dep.c
+++ b/os_dep.c
@@ -1047,7 +1047,7 @@ GC_INNER word GC_page_size = 0;
char stat_buf[STAT_BUF_SIZE];
int f;
word result;
- size_t i, buf_offset = 0, len;
+ int i, buf_offset = 0, len;
/* First try the easy way. This should work for glibc 2.2 */
/* This fails in a prelinked ("prelink" command) executable */
@@ -1076,11 +1076,9 @@ GC_INNER word GC_page_size = 0;
}
# endif
f = open("/proc/self/stat", O_RDONLY);
- if (f < 0
- || (int)(len = (size_t)STAT_READ(f, stat_buf, STAT_BUF_SIZE))
- < 2 * STAT_SKIP) {
- ABORT("Couldn't read /proc/self/stat");
- }
+ if (f < 0)
+ ABORT("Couldn't read /proc/self/stat");
+ len = STAT_READ(f, stat_buf, STAT_BUF_SIZE);
close(f);
/* Skip the required number of fields. This number is hopefully */