aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2001-05-20 02:27:44 +0000
committerRoland McGrath <roland@gnu.org>2001-05-20 02:27:44 +0000
commita500fbcd53e4735fbfa0a3f3e909750884e825a3 (patch)
treea41cc95ea21b9bc4610fff9c34201b61d04af54b
parent0e17ee3c71f956e61b5f79a5c91d3d4814bfd60e (diff)
downloadglibc-a500fbcd53e4735fbfa0a3f3e909750884e825a3.zip
glibc-a500fbcd53e4735fbfa0a3f3e909750884e825a3.tar.gz
glibc-a500fbcd53e4735fbfa0a3f3e909750884e825a3.tar.bz2
2001-05-19 Roland McGrath <roland@frob.com>
* hurd/hurdlookup.c (__hurd_file_name_lookup_retry): Don't leak the result port when failing with ELOOP. Do the ELOOP check when following an absolute symlink target as well as relative. Remove #ifdef SYMLOOP_MAX conditional--it should always be defined.
-rw-r--r--hurd/hurdlookup.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/hurd/hurdlookup.c b/hurd/hurdlookup.c
index 7e5f9af..5a54cfb 100644
--- a/hurd/hurdlookup.c
+++ b/hurd/hurdlookup.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 93, 94, 95, 96, 97, 99 Free Software Foundation, Inc.
+/* Copyright (C) 1992,93,94,95,96,97,99,2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -164,10 +164,11 @@ __hurd_file_name_lookup_retry (error_t (*use_init_port)
/* Fall through. */
case FS_RETRY_NORMAL:
-#ifdef SYMLOOP_MAX
if (nloops++ >= SYMLOOP_MAX)
- return ELOOP;
-#endif
+ {
+ __mach_port_deallocate (__mach_task_self (), *result);
+ return ELOOP;
+ }
/* An empty RETRYNAME indicates we have the final port. */
if (retryname[0] == '\0' &&
@@ -240,6 +241,8 @@ __hurd_file_name_lookup_retry (error_t (*use_init_port)
dirport = INIT_PORT_CRDIR;
if (*result != MACH_PORT_NULL)
__mach_port_deallocate (__mach_task_self (), *result);
+ if (nloops++ >= SYMLOOP_MAX)
+ return ELOOP;
file_name = &retryname[1];
break;