summaryrefslogtreecommitdiff
path: root/hurd
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1994-08-22 12:18:05 +0000
committerRoland McGrath <roland@gnu.org>1994-08-22 12:18:05 +0000
commitd94a4e844ceb59843b56bfc8e939f2cde4b59bc1 (patch)
tree071278569aeb435fcef5097620744c3b2edde464 /hurd
parentb2d9baddd61c0d11d3fb646072487e406847365d (diff)
(__hurd_path_lookup_retry): For malformed number in magic "fd/N", return
ENOENT instead of treating it as bogus magic.
Diffstat (limited to 'hurd')
-rw-r--r--hurd/hurdlookup.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/hurd/hurdlookup.c b/hurd/hurdlookup.c
index e4866459b4..488bfe1a1b 100644
--- a/hurd/hurdlookup.c
+++ b/hurd/hurdlookup.c
@@ -150,18 +150,20 @@ __hurd_path_lookup_retry (file_t crdir,
errno = 0;
fd = (int) strtol (retryname, &end, 10);
if (end == NULL || errno || /* Malformed number. */
- /* Check for excess text after the number. A slash is
- valid; it ends the component. Any other character
- before the null is a violation of the protocol by
- the server. */
+ /* Check for excess text after the number. A slash
+ is valid; it ends the component. Anything else
+ does not name a numeric file descriptor. */
(*end != '/' && *end != '\0'))
{
errno = save;
- goto bad_magic;
+ return ENOENT;
}
*result = __getdport (fd);
if (*result == MACH_PORT_NULL)
{
+ /* If the name was a proper number, but the file
+ descriptor does not exist, we return EBADF instead
+ of ENOENT. */
error_t err = errno;
errno = save;
return err;