diff options
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | daemon/automount.c | 10 |
2 files changed, 9 insertions, 2 deletions
@@ -1,6 +1,7 @@ Since autofs-3.1.5: ------------------- * Add a lookup method for LDAP (from Nalin Dahyabhai). +* Fix small race condition involving errno and SIGCHLD. Since autofs-3.1.4: ------------------- diff --git a/daemon/automount.c b/daemon/automount.c index 35b53ea..5a2b97e 100644 --- a/daemon/automount.c +++ b/daemon/automount.c @@ -3,7 +3,7 @@ * * automount.c - Linux automounter daemon * - * Copyright 1997 Transmeta Corporation - All Rights Reserved + * Copyright 1997-2000 Transmeta Corporation - All Rights Reserved * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -464,9 +464,13 @@ static int handle_packet(void) static void sig_child(int sig) { pid_t pid; - int status; + int status, old_errno; volatile struct pending_mount *mt, * volatile *mtp; + /* We have to preserve errno, since we could have gotten + SIGCHLD between a system call and reading errno. */ + old_errno = errno; + while ( (pid = waitpid(-1, &status, WNOHANG)) > 0 ) { if ( pid == ap.exp_process ) { ap.exp_process = 0; @@ -492,6 +496,8 @@ static void sig_child(int sig) } } } + + errno = old_errno; } static void become_daemon(void) |