[glib/glib-2-26] Don't call close() on -1
- From: Tor Lillqvist <tml src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/glib-2-26] Don't call close() on -1
- Date: Thu, 7 Oct 2010 09:09:04 +0000 (UTC)
commit e01a20ceb958a9a43383a2ef236524ba9f79b6d9
Author: Tor Lillqvist <tml iki fi>
Date: Thu Oct 7 12:04:52 2010 +0300
Don't call close() on -1
Of course, a proper implementation of close() will just ignore an
invalid parameter silently, and set errno. But apparently the "debug"
version of the Microsoft C library generates some noise in this
case. So avoid that. Thanks to John Emmas for reporting.
tests/testglib.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/tests/testglib.c b/tests/testglib.c
index 7625928..b4e29f0 100644
--- a/tests/testglib.c
+++ b/tests/testglib.c
@@ -886,7 +886,8 @@ test_file_functions (void)
fd = g_mkstemp (template);
if (g_test_verbose() && fd != -1)
g_print ("g_mkstemp works even if template doesn't end in XXXXXX\n");
- close (fd);
+ if (fd != -1)
+ close (fd);
strcpy (template, "fooXXXXXX");
fd = g_mkstemp (template);
if (fd == -1)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]