[glib: 1/2] tests: Fix error reporting on prlimit() call failure
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 1/2] tests: Fix error reporting on prlimit() call failure
- Date: Wed, 11 Jul 2018 10:05:17 +0000 (UTC)
commit 6be9f065cb74d8f0a072724a8a2adb12f07cb7d5
Author: Philip Withnall <withnall endlessm com>
Date: Tue Jul 10 16:14:12 2018 +0200
tests: Fix error reporting on prlimit() call failure
prlimit() returns its error code in errno, not as a return value.
Signed-off-by: Philip Withnall <withnall endlessm com>
https://gitlab.gnome.org/GNOME/glib/issues/1044
glib/tests/thread.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/glib/tests/thread.c b/glib/tests/thread.c
index b80019009..b9f87967b 100644
--- a/glib/tests/thread.c
+++ b/glib/tests/thread.c
@@ -21,6 +21,7 @@
*/
#include <config.h>
+#include <errno.h>
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
@@ -146,8 +147,8 @@ test_thread4 (void)
getrlimit (RLIMIT_NPROC, &nl);
nl.rlim_cur = 1;
- if ((ret = prlimit (getpid(), RLIMIT_NPROC, &nl, &ol)) != 0)
- g_error ("prlimit failed: %s", g_strerror (ret));
+ if ((ret = prlimit (getpid (), RLIMIT_NPROC, &nl, &ol)) != 0)
+ g_error ("prlimit failed: %s", g_strerror (errno));
error = NULL;
thread = g_thread_try_new ("a", thread1_func, NULL, &error);
@@ -156,7 +157,7 @@ test_thread4 (void)
g_error_free (error);
if ((ret = prlimit (getpid (), RLIMIT_NPROC, &ol, NULL)) != 0)
- g_error ("resetting RLIMIT_NPROC failed: %s", g_strerror (ret));
+ g_error ("resetting RLIMIT_NPROC failed: %s", g_strerror (errno));
#endif
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]