Rob Browning <[email protected]> writes:
> I'll look a bit more closely at your locking concern. Unless there's
> something else going on, I completely agree that we don't want to exit
> without releasing the lock.
Assuming you don't see anything amiss, perhaps I'll include this:
diff --git a/libguile/posix.c b/libguile/posix.c
index 14fefe183..dc0bbea29 100644
--- a/libguile/posix.c
+++ b/libguile/posix.c
@@ -1059,7 +1059,8 @@ scm_i_c_ttyname (int fd)
// scm_i_misc_mutex for thread safety. In glibc 2.3.2 two threads
// continuously calling ttyname will otherwise get an overwrite quite
// easily.
- scm_i_scm_pthread_mutex_lock (&scm_i_misc_mutex);
+ scm_dynwind_begin (0);
+ scm_i_dynwind_pthread_mutex_lock (&scm_i_misc_mutex);
char *global_name;
SCM_SYSCALL (global_name = ttyname (fd));
err = errno;
@@ -1068,11 +1069,11 @@ scm_i_c_ttyname (int fd)
// Not necessary if ttyname() must also respect TTY_NAME_MAX.
// POSIX ttyname description isn't completely clear.
if (strlen (global_name) > TTY_NAME_MAX - 1)
err = ERANGE;
else
strcpy(name, global_name);
}
- scm_i_pthread_mutex_unlock (&scm_i_misc_mutex);
+ scm_dynwind_end ();
#endif // HAVE_TTYNAME
if (err)
Thanks
--
Rob Browning
rlb @defaultvalue.org and @debian.org
GPG as of 2011-07-10 E6A9 DA3C C9FD 1FF8 C676 D2C4 C0F0 39E9 ED1B 597A
GPG as of 2002-11-03 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4