X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fmetadata%2Fconsole-unix.c;h=fe71923dbbadbdb97378b047a0f822f80a977749;hb=edbc5c2334e10836479d1cc528c68d4ad5b47440;hp=29ce37fc141bc4b8a92049e55590f10c7eef16b4;hpb=0b710d0c2ec6ea1dae61c255e6050e1a175ba81a;p=mono.git diff --git a/mono/metadata/console-unix.c b/mono/metadata/console-unix.c index 29ce37fc141..fe71923dbba 100644 --- a/mono/metadata/console-unix.c +++ b/mono/metadata/console-unix.c @@ -1,5 +1,6 @@ -/* - * console-io.c: ConsoleDriver internal calls for Unix systems. +/** + * \file + * ConsoleDriver internal calls for Unix systems. * * Author: * Gonzalo Paniagua Javier (gonzalo@ximian.com) @@ -7,10 +8,6 @@ * Copyright (C) 2005-2009 Novell, Inc. (http://www.novell.com) * Licensed under the MIT license. See LICENSE file in the project root for full license information. */ -#if defined(__native_client__) -#include "console-null.c" -#else - #include #include #include @@ -34,9 +31,10 @@ #include #include #include -#include +#include #include #include +#include /* On solaris, curses.h must come before both termios.h and term.h */ #ifdef HAVE_CURSES_H @@ -247,15 +245,17 @@ do_console_cancel_event (void) mono_error_cleanup (&error); return; } - mono_field_static_get_value (vtable, cancel_handler_field, &load_value); - if (load_value == NULL) + mono_field_static_get_value_checked (vtable, cancel_handler_field, &load_value, &error); + if (load_value == NULL || !is_ok (&error)) { + mono_error_cleanup (&error); return; + } klass = load_value->object.vtable->klass; method = mono_class_get_method_from_name (klass, "BeginInvoke", -1); g_assert (method != NULL); - mono_threadpool_ms_begin_invoke (domain, (MonoObject*) load_value, method, NULL, &error); + mono_threadpool_begin_invoke (domain, (MonoObject*) load_value, method, NULL, &error); if (!is_ok (&error)) { g_warning ("Couldn't invoke System.Console cancel handler due to %s", mono_error_get_message (&error)); mono_error_cleanup (&error); @@ -453,12 +453,16 @@ ves_icall_System_ConsoleDriver_TtySetup (MonoString *keypad, MonoString *teardow if (dims == -1){ int cols = 0, rows = 0; - const char *str = g_getenv ("COLUMNS"); - if (str != NULL) + char *str = g_getenv ("COLUMNS"); + if (str != NULL) { cols = atoi (str); + g_free (str); + } str = g_getenv ("LINES"); - if (str != NULL) + if (str != NULL) { rows = atoi (str); + g_free (str); + } if (cols != 0 && rows != 0) cols_and_lines = (cols << 16) | rows; @@ -496,18 +500,24 @@ ves_icall_System_ConsoleDriver_TtySetup (MonoString *keypad, MonoString *teardow if (setup_finished) return TRUE; - keypad_xmit_str = keypad != NULL ? mono_string_to_utf8 (keypad) : NULL; + keypad_xmit_str = NULL; + if (keypad != NULL) { + keypad_xmit_str = mono_string_to_utf8_checked (keypad, &error); + if (mono_error_set_pending_exception (&error)) + return FALSE; + } console_set_signal_handlers (); setup_finished = TRUE; if (!atexit_called) { - if (teardown != NULL) - teardown_str = mono_string_to_utf8 (teardown); + if (teardown != NULL) { + teardown_str = mono_string_to_utf8_checked (teardown, &error); + if (mono_error_set_pending_exception (&error)) + return FALSE; + } mono_atexit (tty_teardown); } return TRUE; } -#endif /* #if defined(__native_client__) */ -