aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sysdeps/mach/hurd/readlink.c5
-rw-r--r--sysdeps/mach/hurd/readlinkat.c5
2 files changed, 8 insertions, 2 deletions
diff --git a/sysdeps/mach/hurd/readlink.c b/sysdeps/mach/hurd/readlink.c
index 7704627..2d75ef7 100644
--- a/sysdeps/mach/hurd/readlink.c
+++ b/sysdeps/mach/hurd/readlink.c
@@ -31,7 +31,7 @@ __readlink (const char *file_name, char *buf, size_t len)
file_t file;
struct stat64 st;
- file = __file_name_lookup (file_name, O_READ | O_NOLINK, 0);
+ file = __file_name_lookup (file_name, O_NOLINK, 0);
if (file == MACH_PORT_NULL)
return -1;
@@ -41,6 +41,9 @@ __readlink (const char *file_name, char *buf, size_t len)
{
char *rbuf = buf;
+ __mach_port_deallocate (__mach_task_self (), file);
+ file = __file_name_lookup (file_name, O_READ | O_NOLINK, 0);
+
err = __io_read (file, &rbuf, &len, 0, len);
if (!err && rbuf != buf)
{
diff --git a/sysdeps/mach/hurd/readlinkat.c b/sysdeps/mach/hurd/readlinkat.c
index 059aad9..113b92b 100644
--- a/sysdeps/mach/hurd/readlinkat.c
+++ b/sysdeps/mach/hurd/readlinkat.c
@@ -32,7 +32,7 @@ readlinkat (int fd, const char *file_name, char *buf, size_t len)
file_t file;
struct stat64 st;
- file = __file_name_lookup_at (fd, 0, file_name, O_READ | O_NOLINK, 0);
+ file = __file_name_lookup_at (fd, 0, file_name, O_NOLINK, 0);
if (file == MACH_PORT_NULL)
return -1;
@@ -42,6 +42,9 @@ readlinkat (int fd, const char *file_name, char *buf, size_t len)
{
char *rbuf = buf;
+ __mach_port_deallocate (__mach_task_self (), file);
+ file = __file_name_lookup_at (fd, 0, file_name, O_READ | O_NOLINK, 0);
+
err = __io_read (file, &rbuf, &len, 0, len);
if (!err && rbuf != buf)
{