summaryrefslogtreecommitdiff
path: root/sysdeps/posix/getcwd.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/posix/getcwd.c')
-rw-r--r--sysdeps/posix/getcwd.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/sysdeps/posix/getcwd.c b/sysdeps/posix/getcwd.c
index 38cf4e7fc8..b53433a2dc 100644
--- a/sysdeps/posix/getcwd.c
+++ b/sysdeps/posix/getcwd.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2018 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
@@ -175,8 +175,8 @@ extern char *alloca ();
# include <not-cancel.h>
# include <kernel-features.h>
#else
-# define openat64_not_cancel_3(dfd, name, mode) openat64 (dfd, name, mode)
-# define close_not_cancel_no_status(fd) close (fd)
+# define __openat64_nocancel(dfd, name, mode) openat64 (dfd, name, mode)
+# define __close_nocancel_nostatus(fd) close (fd)
#endif
#ifndef PATH_MAX
@@ -281,13 +281,7 @@ __getcwd (char *buf, size_t size)
while (!(thisdev == rootdev && thisino == rootino))
{
if (__have_atfcts >= 0)
- {
- int mode = O_RDONLY;
-#ifdef O_CLOEXEC
- mode |= O_CLOEXEC;
-#endif
- fd = openat64_not_cancel_3 (fd, "..", mode);
- }
+ fd = __openat64_nocancel (fd, "..", O_RDONLY | O_CLOEXEC);
else
fd = -1;
if (fd >= 0)
@@ -324,7 +318,7 @@ __getcwd (char *buf, size_t size)
}
else
{
- new = realloc ((__ptr_t) dotlist, dotsize * 2 + 1);
+ new = realloc ((void *) dotlist, dotsize * 2 + 1);
if (new == NULL)
goto lose;
dotp = &new[dotsize];
@@ -498,7 +492,7 @@ __getcwd (char *buf, size_t size)
#ifndef __ASSUME_ATFCTS
if (dotlist != dots)
- free ((__ptr_t) dotlist);
+ free ((void *) dotlist);
#endif
size_t used = path + allocated - pathp;
@@ -522,12 +516,12 @@ __getcwd (char *buf, size_t size)
int save_errno = errno;
#ifndef __ASSUME_ATFCTS
if (dotlist != dots)
- free ((__ptr_t) dotlist);
+ free ((void *) dotlist);
#endif
if (dirstream != NULL)
__closedir (dirstream);
if (fd_needs_closing)
- close_not_cancel_no_status (fd);
+ __close_nocancel_nostatus (fd);
#ifndef NO_ALLOCATION
if (buf == NULL)
free (path);