diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2015-10-11 22:14:18 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2015-10-11 22:14:18 +0200 |
commit | 1fa0cec1b643483918933b5d6a419e77d6e16c6d (patch) | |
tree | 4078d281213484d7ad45741ab4fd113b77496724 /libnetfs | |
parent | bd7e7ae44c78bcfe623dec8636375685c8c30be3 (diff) |
Make netfs_S_io_reauthenticate handle allocation errors
* libnetfs/io-reauthenticate.c (netfs_S_io_reauthenticate): Loop when
netfs_make_protid fails with EINTR, return error when it fails otherwise.
Diffstat (limited to 'libnetfs')
-rw-r--r-- | libnetfs/io-reauthenticate.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/libnetfs/io-reauthenticate.c b/libnetfs/io-reauthenticate.c index 91928130..8ff4182b 100644 --- a/libnetfs/io-reauthenticate.c +++ b/libnetfs/io-reauthenticate.c @@ -31,8 +31,18 @@ netfs_S_io_reauthenticate (struct protid *user, mach_port_t rend_port) if (!user) return EOPNOTSUPP; + /* This routine must carefully ignore EINTR because we + are a simpleroutine, so callers won't know to restart. */ + pthread_mutex_lock (&user->po->np->lock); - newpi = netfs_make_protid (user->po, 0); + do + newpi = netfs_make_protid (user->po, 0); + while (! newpi && errno == EINTR); + if (! newpi) + { + pthread_mutex_unlock (&user->po->np->lock); + return errno; + } newright = ports_get_send_right (newpi); assert (newright != MACH_PORT_NULL); |