* nis/nis_ping.c: Remove unnecessary conditionals before

nis_freeresult calls.
	* nis/nis_ismember.c: Likewise.
This commit is contained in:
Ulrich Drepper 2006-04-08 20:28:00 +00:00
parent 0a21e40021
commit 7960f2a704
5 changed files with 35 additions and 12 deletions

View File

@ -1,5 +1,9 @@
2006-04-08 Ulrich Drepper <drepper@redhat.com>
* nis/nis_ping.c: Remove unnecessary conditionals before
nis_freeresult calls.
* nis/nis_ismember.c: Likewise.
* elf/rtld.c (process_envvars): Fix handling of LD_POINTER_GUARD.
Reported by genesh@comcast.net.

View File

@ -1,4 +1,4 @@
/* Copyright (c) 1997, 1998, 1999 Free Software Foundation, Inc.
/* Copyright (c) 1997, 1998, 1999, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997.
@ -47,8 +47,7 @@ internal_ismember (const_nis_name principal, const_nis_name group)
res = nis_lookup (buf, EXPAND_NAME|FOLLOW_LINKS);
if (res == NULL || NIS_RES_STATUS (res) != NIS_SUCCESS)
{
if (res)
nis_freeresult (res);
nis_freeresult (res);
return 0;
}

View File

@ -1,4 +1,4 @@
/* Copyright (c) 1997, 1998, 1999 Free Software Foundation, Inc.
/* Copyright (c) 1997, 1998, 1999, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997.
@ -39,8 +39,7 @@ nis_ping (const_nis_name dirname, unsigned int utime,
res = nis_lookup (dirname, MASTER_ONLY);
if (res == NULL || NIS_RES_STATUS (res) != NIS_SUCCESS)
{
if (res)
nis_freeresult (res);
nis_freeresult (res);
return;
}
obj = res->objects.objects_val;
@ -51,8 +50,7 @@ nis_ping (const_nis_name dirname, unsigned int utime,
/* Check if obj is really a diryectory object */
if (__type_of (obj) != NIS_DIRECTORY_OBJ)
{
if (res != NULL)
nis_freeresult (res);
nis_freeresult (res);
return;
}
@ -68,6 +66,5 @@ nis_ping (const_nis_name dirname, unsigned int utime,
NIS_PING, (xdrproc_t) _xdr_ping_args,
(caddr_t) &args, (xdrproc_t) xdr_void,
(caddr_t) NULL, 0, NULL);
if (res)
nis_freeresult (res);
nis_freeresult (res);
}

View File

@ -1,3 +1,10 @@
2006-04-08 Ulrich Drepper <drepper@redhat.com>
* init.c (sigcancel_handler): Compare with correct PID even if the
thread is in the middle of a fork call.
(sighandler_setxid): Likewise.
Reported by Suzuki K P <suzuki@in.ibm.com> .
2006-04-07 Jakub Jelinek <jakub@redhat.com>
* pthreadP.h (FUTEX_TID_MASK): Sync with kernel.

View File

@ -148,6 +148,14 @@ static const struct pthread_functions pthread_functions =
static void
sigcancel_handler (int sig, siginfo_t *si, void *ctx)
{
#ifdef __ASSUME_CORRECT_SI_PID
/* Determine the process ID. It might be negative if the thread is
in the middle of a fork() call. */
pid_t pid = THREAD_GETMEM (THREAD_SELF, pid);
if (__builtin_expect (pid < 0, 0))
pid = -pid;
#endif
/* Safety check. It would be possible to call this function for
other signals and send a signal from another process. This is not
correct and might even be a security problem. Try to catch as
@ -156,7 +164,7 @@ sigcancel_handler (int sig, siginfo_t *si, void *ctx)
#ifdef __ASSUME_CORRECT_SI_PID
/* Kernels before 2.5.75 stored the thread ID and not the process
ID in si_pid so we skip this test. */
|| si->si_pid != THREAD_GETMEM (THREAD_SELF, pid)
|| si->si_pid != pid
#endif
|| si->si_code != SI_TKILL)
return;
@ -201,6 +209,14 @@ struct xid_command *__xidcmd attribute_hidden;
static void
sighandler_setxid (int sig, siginfo_t *si, void *ctx)
{
#ifdef __ASSUME_CORRECT_SI_PID
/* Determine the process ID. It might be negative if the thread is
in the middle of a fork() call. */
pid_t pid = THREAD_GETMEM (THREAD_SELF, pid);
if (__builtin_expect (pid < 0, 0))
pid = -pid;
#endif
/* Safety check. It would be possible to call this function for
other signals and send a signal from another process. This is not
correct and might even be a security problem. Try to catch as
@ -209,7 +225,7 @@ sighandler_setxid (int sig, siginfo_t *si, void *ctx)
#ifdef __ASSUME_CORRECT_SI_PID
/* Kernels before 2.5.75 stored the thread ID and not the process
ID in si_pid so we skip this test. */
|| si->si_pid != THREAD_GETMEM (THREAD_SELF, pid)
|| si->si_pid != pid
#endif
|| si->si_code != SI_TKILL)
return;