public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Ulrich Drepper <drepper@redhat.com>
Cc: Glibc hackers <libc-hacker@sources.redhat.com>
Subject: [PATCH] Fix NPTL forward.c
Date: Thu, 11 Mar 2004 12:26:00 -0000	[thread overview]
Message-ID: <20040311101715.GE3822@sunsite.ms.mff.cuni.cz> (raw)

Hi!

While FORWARD macro has default return value as last argument, FORWARD2
has default action.  With defaction 0 we end up with:
if (someptr == NULL)
  0;
(*someptr) (arguments);
which will segfault if libpthread.so is not loaded.

2004-03-11  Jakub Jelinek  <jakub@redhat.com>

	* forward.c (__pthread_cond_broadcast_2_0,
	__pthread_cond_destroy_2_0, __pthread_cond_init_2_0,
	__pthread_cond_signal_2_0, __pthread_cond_wait_2_0,
	__pthread_cond_timedwait_2_0): Use return 0 as defaction instead of
	0.

--- libc/nptl/forward.c.jj	2004-03-10 10:32:00.000000000 +0100
+++ libc/nptl/forward.c	2004-03-11 12:03:14.211544646 +0100
@@ -89,7 +89,7 @@ FORWARD (pthread_condattr_init, (pthread
 
 #if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
 FORWARD2 (__pthread_cond_broadcast_2_0, int attribute_compat_text_section,
-	  (pthread_cond_2_0_t *cond), (cond), 0)
+	  (pthread_cond_2_0_t *cond), (cond), return 0)
 compat_symbol (libc, __pthread_cond_broadcast_2_0, pthread_cond_broadcast,
 	       GLIBC_2_0);
 #endif
@@ -99,7 +99,7 @@ versioned_symbol (libc, __pthread_cond_b
 
 #if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
 FORWARD2 (__pthread_cond_destroy_2_0, int attribute_compat_text_section,
-	  (pthread_cond_2_0_t *cond), (cond), 0)
+	  (pthread_cond_2_0_t *cond), (cond), return 0)
 compat_symbol (libc, __pthread_cond_destroy_2_0, pthread_cond_destroy,
 	       GLIBC_2_0);
 #endif
@@ -110,7 +110,7 @@ versioned_symbol (libc, __pthread_cond_d
 #if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
 FORWARD2 (__pthread_cond_init_2_0, int attribute_compat_text_section,
 	  (pthread_cond_2_0_t *cond, const pthread_condattr_t *cond_attr),
-	  (cond, cond_attr), 0)
+	  (cond, cond_attr), return 0)
 compat_symbol (libc, __pthread_cond_init_2_0, pthread_cond_init, GLIBC_2_0);
 #endif
 FORWARD (__pthread_cond_init,
@@ -120,7 +120,7 @@ versioned_symbol (libc, __pthread_cond_i
 
 #if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
 FORWARD2 (__pthread_cond_signal_2_0, int attribute_compat_text_section,
-	  (pthread_cond_2_0_t *cond), (cond), 0)
+	  (pthread_cond_2_0_t *cond), (cond), return 0)
 compat_symbol (libc, __pthread_cond_signal_2_0, pthread_cond_signal,
 	       GLIBC_2_0);
 #endif
@@ -130,7 +130,8 @@ versioned_symbol (libc, __pthread_cond_s
 
 #if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
 FORWARD2 (__pthread_cond_wait_2_0, int attribute_compat_text_section,
-	  (pthread_cond_2_0_t *cond, pthread_mutex_t *mutex), (cond, mutex), 0)
+	  (pthread_cond_2_0_t *cond, pthread_mutex_t *mutex), (cond, mutex),
+	  return 0)
 compat_symbol (libc, __pthread_cond_wait_2_0, pthread_cond_wait,
 	       GLIBC_2_0);
 #endif
@@ -142,7 +143,8 @@ versioned_symbol (libc, __pthread_cond_w
 #if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
 FORWARD2 (__pthread_cond_timedwait_2_0, int attribute_compat_text_section,
 	  (pthread_cond_2_0_t *cond, pthread_mutex_t *mutex,
-	   const struct timespec *abstime), (cond, mutex, abstime), 0)
+	   const struct timespec *abstime), (cond, mutex, abstime),
+	  return 0)
 compat_symbol (libc, __pthread_cond_timedwait_2_0, pthread_cond_timedwait,
 	       GLIBC_2_0);
 #endif

	Jakub

             reply	other threads:[~2004-03-11 12:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-11 12:26 Jakub Jelinek [this message]
2004-03-11 16:12 ` Ulrich Drepper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040311101715.GE3822@sunsite.ms.mff.cuni.cz \
    --to=jakub@redhat.com \
    --cc=drepper@redhat.com \
    --cc=libc-hacker@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).