This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch master updated. glibc-2.20-58-g99d86ea


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  99d86ea324820ec7b7755377182922a6233e25fb (commit)
      from  06210a44e98960b2c591f3ffad1876e2f64337c3 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=99d86ea324820ec7b7755377182922a6233e25fb

commit 99d86ea324820ec7b7755377182922a6233e25fb
Author: Arjun Shankar <arjun.is@lostca.se>
Date:   Mon Oct 6 10:23:17 2014 +0530

    Write errors to stdout and not stderr in nptl/tst-setuid3.c
    
    nptl/tst-setuid3.c was using the `err' and `errx' functions to write
    error messages. This wrote to stderr instead of the preferred stdout.

diff --git a/ChangeLog b/ChangeLog
index dedc578..ad73cf4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2014-10-06  Arjun Shankar  <arjun.is@lostca.se>
+
+	* nptl/tst-setuid3.c: Write errors to stdout.
+
 2014-10-01  Kostya Serebryany  <konstantin.s.serebryany@gmail.com>
 
 	* elf/dl-deps.c
diff --git a/nptl/tst-setuid3.c b/nptl/tst-setuid3.c
index f78f485..a48d742 100644
--- a/nptl/tst-setuid3.c
+++ b/nptl/tst-setuid3.c
@@ -15,7 +15,7 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <err.h>
+#include <stdio.h>
 #include <errno.h>
 #include <pthread.h>
 #include <stdbool.h>
@@ -27,15 +27,21 @@ static const uid_t test_uid = 1;
 static pthread_barrier_t barrier1;
 static pthread_barrier_t barrier2;
 
+#define FAIL(fmt, ...) \
+  do { printf ("FAIL: " fmt "\n", __VA_ARGS__); _exit (1); } while (0)
+
+#define FAIL_ERR(fmt, ...) \
+  do { printf ("FAIL: " fmt ": %m\n", __VA_ARGS__); _exit (1); } while (0)
+
 static void *
 thread_func (void *ctx __attribute__ ((unused)))
 {
   int ret = pthread_barrier_wait (&barrier1);
   if (ret != PTHREAD_BARRIER_SERIAL_THREAD && ret != 0)
-    errx (1, "pthread_barrier_wait (barrier1) (on thread): %d", ret);
+    FAIL ("pthread_barrier_wait (barrier1) (on thread): %d", ret);
   ret = pthread_barrier_wait (&barrier2);
   if (ret != PTHREAD_BARRIER_SERIAL_THREAD && ret != 0)
-    errx (1, "pthread_barrier_wait (barrier2) (on thread): %d", ret);
+    FAIL ("pthread_barrier_wait (barrier2) (on thread): %d", ret);
   return NULL;
 }
 
@@ -46,13 +52,13 @@ setuid_failure (int phase)
   switch (ret)
     {
     case 0:
-      errx (1, "setuid succeeded unexpectedly in phase %d", phase);
+      FAIL ("setuid succeeded unexpectedly in phase %d", phase);
     case -1:
       if (errno != EPERM)
-	err (1, "setuid phase %d", phase);
+	FAIL_ERR ("setuid phase %d", phase);
       break;
     default:
-      errx (1, "invalid setuid return value in phase %d: %d", phase, ret);
+      FAIL ("invalid setuid return value in phase %d: %d", phase, ret);
     }
 }
 
@@ -61,41 +67,41 @@ do_test (void)
 {
   if (getuid () == 0)
     if (setuid (test_uid) != 0)
-      err (1, "setuid (%u)", (unsigned) test_uid);
+      FAIL_ERR ("setuid (%u)", (unsigned) test_uid);
   if (setuid (getuid ()))
-    err (1, "setuid (getuid ())");
+    FAIL_ERR ("setuid (%s)", "getuid ()");
   setuid_failure (1);
 
   int ret = pthread_barrier_init (&barrier1, NULL, 2);
   if (ret != 0)
-    errx (1, "pthread_barrier_init (barrier1): %d", ret);
+    FAIL ("pthread_barrier_init (barrier1): %d", ret);
   ret = pthread_barrier_init (&barrier2, NULL, 2);
   if (ret != 0)
-    errx (1, "pthread_barrier_init (barrier2): %d", ret);
+    FAIL ("pthread_barrier_init (barrier2): %d", ret);
 
   pthread_t thread;
   ret = pthread_create (&thread, NULL, thread_func, NULL);
   if (ret != 0)
-    errx (1, "pthread_create: %d", ret);
+    FAIL ("pthread_create: %d", ret);
 
   /* Ensure that the thread is running properly.  */
   ret = pthread_barrier_wait (&barrier1);
   if (ret != 0)
-    errx (1, "pthread_barrier_wait (barrier1): %d", ret);
+    FAIL ("pthread_barrier_wait (barrier1): %d", ret);
 
   setuid_failure (2);
 
   /* Check success case. */
   if (setuid (getuid ()) != 0)
-    err (1, "setuid (getuid ())");
+    FAIL_ERR ("setuid (%s)", "getuid ()");
 
   /* Shutdown.  */
   ret = pthread_barrier_wait (&barrier2);
   if (ret != PTHREAD_BARRIER_SERIAL_THREAD && ret != 0)
-    errx (1, "pthread_barrier_wait (barrier2): %d", ret);
+    FAIL ("pthread_barrier_wait (barrier2): %d", ret);
 
   if (ret != PTHREAD_BARRIER_SERIAL_THREAD && ret != 0)
-    errx (1, "pthread_join: %d", ret);
+    FAIL ("pthread_join: %d", ret);
 
   return 0;
 }

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog          |    4 ++++
 nptl/tst-setuid3.c |   36 +++++++++++++++++++++---------------
 2 files changed, 25 insertions(+), 15 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]