From: ivmai Date: Tue, 22 Mar 2011 17:50:16 +0000 (+0000) Subject: 2011-03-22 Ivan Maidanski X-Git-Tag: gc7_2alpha6~86 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2de7add91598ef5ba24e869c15b4003bc57819b1;p=gc 2011-03-22 Ivan Maidanski * 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). --- diff --git a/ChangeLog b/ChangeLog index 62c10424..e4765d19 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2011-03-22 Ivan Maidanski + + * 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). + 2011-03-20 Ivan Maidanski * blacklst.c (GC_bl_init_no_interiors): New function (the code diff --git a/misc.c b/misc.c index a81b11c5..0843bcee 100644 --- a/misc.c +++ b/misc.c @@ -1389,7 +1389,7 @@ GC_API GC_warn_proc GC_CALL GC_get_warn_proc(void) # ifndef LINT2 if (!msg) return; /* to suppress compiler warnings in ABORT callers. */ # endif -# if defined(MSWIN32) && defined(NO_DEBUGGING) +# if defined(MSWIN32) && (defined(NO_DEBUGGING) || defined(LINT2)) /* A more user-friendly abort after showing fatal message. */ _exit(-1); /* exit on error without running "at-exit" callbacks */ # elif defined(MSWINCE) && defined(NO_DEBUGGING) 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 */