aboutsummaryrefslogtreecommitdiff
path: root/hurd
diff options
context:
space:
mode:
Diffstat (limited to 'hurd')
-rw-r--r--hurd/alloc-fd.c13
-rw-r--r--hurd/fopenport.c5
-rw-r--r--hurd/getdport.c12
-rw-r--r--hurd/hurdselect.c13
-rw-r--r--hurd/hurdsock.c7
5 files changed, 14 insertions, 36 deletions
diff --git a/hurd/alloc-fd.c b/hurd/alloc-fd.c
index 60c8b00897..4edc742122 100644
--- a/hurd/alloc-fd.c
+++ b/hurd/alloc-fd.c
@@ -34,10 +34,7 @@ _hurd_alloc_fd (int *fd, int first_fd)
long int rlimit;
if (first_fd < 0)
- {
- errno = EINVAL;
- return NULL;
- }
+ return __hurd_fail (EINVAL), NULL;
crit = _hurd_critical_section_lock ();
@@ -99,7 +96,7 @@ _hurd_alloc_fd (int *fd, int first_fd)
if (size * sizeof (*_hurd_dtable) < size)
{
/* Integer overflow! */
- errno = ENOMEM;
+ __hurd_fail (ENOMEM);
goto out;
}
@@ -124,13 +121,13 @@ _hurd_alloc_fd (int *fd, int first_fd)
goto search;
}
else
- errno = ENOMEM;
+ __hurd_fail (ENOMEM);
}
else
- errno = EMFILE;
+ __hurd_fail (EMFILE);
}
else
- errno = EINVAL; /* Bogus FIRST_FD value. */
+ __hurd_fail (EINVAL); /* Bogus FIRST_FD value. */
out:
__mutex_unlock (&_hurd_dtable_lock);
diff --git a/hurd/fopenport.c b/hurd/fopenport.c
index be6aa30c7e..a1efc5424d 100644
--- a/hurd/fopenport.c
+++ b/hurd/fopenport.c
@@ -126,10 +126,7 @@ __fopenport (mach_port_t port, const char *mode)
/* Check the access mode. */
if ((pflags & needflags) != needflags)
- {
- errno = EBADF;
- return NULL;
- }
+ return __hurd_fail (EBADF), NULL;
return fopencookie ((void *) (uintptr_t) port,
mode, funcsio);
diff --git a/hurd/getdport.c b/hurd/getdport.c
index 2bccc59789..27fc41f420 100644
--- a/hurd/getdport.c
+++ b/hurd/getdport.c
@@ -35,18 +35,12 @@ __getdport (int fd)
so we don't bother allocating a real table. */
if (_hurd_init_dtable == NULL)
- {
- /* Never had a descriptor table. */
- errno = EBADF;
- return MACH_PORT_NULL;
- }
+ /* Never had a descriptor table. */
+ return __hurd_fail (EBADF), MACH_PORT_NULL;
if (fd < 0 || (unsigned int) fd > _hurd_init_dtablesize
|| _hurd_init_dtable[fd] == MACH_PORT_NULL)
- {
- errno = EBADF;
- return MACH_PORT_NULL;
- }
+ return __hurd_fail (EBADF), MACH_PORT_NULL;
else
{
__mach_port_mod_refs (__mach_task_self (), _hurd_init_dtable[fd],
diff --git a/hurd/hurdselect.c b/hurd/hurdselect.c
index 9630cae474..940276396c 100644
--- a/hurd/hurdselect.c
+++ b/hurd/hurdselect.c
@@ -71,10 +71,7 @@ _hurd_select (int nfds,
struct hurd_sigstate *ss = NULL;
if (nfds < 0 || (pollfds == NULL && nfds > FD_SETSIZE))
- {
- errno = EINVAL;
- return -1;
- }
+ return __hurd_fail (EINVAL);
#define IO_SELECT_REPLY_MSGID (21012 + 100) /* XXX */
#define IO_SELECT_TIMEOUT_REPLY_MSGID (21031 + 100) /* XXX */
@@ -86,10 +83,7 @@ _hurd_select (int nfds,
struct timespec now;
if (timeout->tv_sec < 0 || ! valid_nanoseconds (timeout->tv_nsec))
- {
- errno = EINVAL;
- return -1;
- }
+ return __hurd_fail (EINVAL);
err = __clock_gettime (CLOCK_REALTIME, &now);
if (err)
@@ -281,8 +275,7 @@ _hurd_select (int nfds,
{
if (sigmask)
__sigprocmask (SIG_SETMASK, &oset, NULL);
- errno = EBADF;
- return -1;
+ return __hurd_fail (EBADF);
}
if (nfds > _hurd_dtablesize)
diff --git a/hurd/hurdsock.c b/hurd/hurdsock.c
index 58c27feb2b..1d04047a02 100644
--- a/hurd/hurdsock.c
+++ b/hurd/hurdsock.c
@@ -48,10 +48,7 @@ _hurd_socket_server (int domain, int dead)
socket_t server;
if (domain < 0)
- {
- errno = EAFNOSUPPORT;
- return MACH_PORT_NULL;
- }
+ return __hurd_fail (EAFNOSUPPORT), MACH_PORT_NULL;
retry:
HURD_CRITICAL_BEGIN;
@@ -99,7 +96,7 @@ retry:
if (server == MACH_PORT_NULL && errno == ENOENT)
/* If the server node is absent, we don't support that protocol. */
- errno = EAFNOSUPPORT;
+ __hurd_fail (EAFNOSUPPORT);
__mutex_unlock (&lock);
HURD_CRITICAL_END;