diff options
author | ivmai <ivmai> | 2011-03-22 17:50:16 +0000 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2011-07-26 21:06:57 +0400 |
commit | 2de7add91598ef5ba24e869c15b4003bc57819b1 (patch) | |
tree | 2640539b96ce5b77bb8a437a1e968a1cd92dd959 /os_dep.c | |
parent | ad269687a9cb0d834eed41ad67c9c4acbad205c9 (diff) | |
download | bdwgc-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.c | 10 |
1 files changed, 4 insertions, 6 deletions
@@ -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 */ |