about summary refs log tree commit diff
path: root/sysdeps/generic/utmp_file.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-08-25 20:14:50 +0000
committerRoland McGrath <roland@gnu.org>2002-08-25 20:14:50 +0000
commit6ce3881de539b0a76673da3ea6fdac7453b47910 (patch)
tree2c5ab5ce32db69bf2d38b1759ec61e5f9fc3ff78 /sysdeps/generic/utmp_file.c
parentd8a36a812d9ee3c2fd935d2391b27303903f0091 (diff)
downloadglibc-6ce3881de539b0a76673da3ea6fdac7453b47910.tar.gz
glibc-6ce3881de539b0a76673da3ea6fdac7453b47910.tar.xz
glibc-6ce3881de539b0a76673da3ea6fdac7453b47910.zip
* sysdeps/generic/utmp_file.c (UNLOCK_FILE): Clear alarm before
	resetting handler, to avoid the possibility of a spurious SIGALRM
	delivered to the user's handler.
	Reported by Amit D. Chaudhary <amitc@brocade.com>,

	* misc/Makefile (CFLAGS-init-misc.c): Varaible removed.  It served to
	set -fkeep-inline-functions, which is not needed for the current file.

	* sysdeps/generic/ldsodefs.h: Add attribute_hidden to *_internal decls.
	(_dl_setup_hash): Add attribute_hidden.
	(_dl_sysdep_start, _dl_sysdep_start_cleanup): Likewise.
	(_dl_sysdep_read_whole_file, _dl_dprintf): Likewise.
	(_dl_new_object, _dl_map_object_deps): Likewise.
	(_dl_map_object_deps_internal): Remove decl.
	* elf/rtld.c (__mempcpy, _exit): Redeclare locally as hidden.

	* sysdeps/i386/dl-machine.h [PI_STATIC_AND_HIDDEN
	&& HAVE_VISIBILITY_ATTRIBUTE && HAVE_HIDDEN
	&& !HAVE_BROKEN_VISIBILITY_ATTRIBUTE]
	(elf_machine_dynamic, elf_machine_load_address): Rewritten without asm,
	instead relying on the compiler to produce only GOTOFF variable refs.
Diffstat (limited to 'sysdeps/generic/utmp_file.c')
-rw-r--r--sysdeps/generic/utmp_file.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/sysdeps/generic/utmp_file.c b/sysdeps/generic/utmp_file.c
index 0baf4118e9..d2a2b33ce0 100644
--- a/sysdeps/generic/utmp_file.c
+++ b/sysdeps/generic/utmp_file.c
@@ -74,9 +74,16 @@ static void timeout_handler (int signum) {};
   fl.l_type = F_UNLCK;                                                  \
   __fcntl ((fd), F_SETLKW, &fl);                                        \
                                                                         \
-  /* Reset the signal handler and alarm.  */                            \
+  /* Reset the signal handler and alarm.  We must reset the alarm	\
+     before resetting the handler so our alarm does not generate a	\
+     spurious SIGALRM seen by the user.  However, we cannot just set	\
+     the user's old alarm before restoring the handler, because then	\
+     it's possible our handler could catch the user alarm's SIGARLM	\
+     and then the user would never see the signal he expected.  */	\
+  alarm (0);								\
   __sigaction (SIGALRM, &old_action, NULL);                             \
-  alarm (old_timeout);                                                  \
+  if (old_timeout != 0)							\
+    alarm (old_timeout);                                                \
 } while (0)