--- embedaddon/libiconv/srclib/areadlink.c 2012/05/29 09:29:43 1.1.1.2 +++ embedaddon/libiconv/srclib/areadlink.c 2021/03/17 13:38:46 1.1.1.3 @@ -1,7 +1,7 @@ /* areadlink.c -- readlink wrapper to return the link name in malloc'd storage Unlike xreadlink and xreadlink_with_size, don't ever call exit. - Copyright (C) 2001, 2003-2007, 2009-2011 Free Software Foundation, Inc. + Copyright (C) 2001, 2003-2007, 2009-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see . */ + along with this program. If not, see . */ /* Written by Jim Meyering and Bruno Haible . */ @@ -25,6 +25,23 @@ #include "areadlink.h" #include "careadlinkat.h" + +#include +#include + +/* Get the symbolic link value of FILENAME and put it into BUFFER, with + size BUFFER_SIZE. This function acts like readlink but has + readlinkat's signature. */ +static ssize_t +careadlinkatcwd (int fd, char const *filename, char *buffer, + size_t buffer_size) +{ + /* FD must be AT_FDCWD here, otherwise the caller is using this + function in contexts it was not meant for. */ + if (fd != AT_FDCWD) + abort (); + return readlink (filename, buffer, buffer_size); +} /* Call readlink to get the symbolic link value of FILENAME. Return a pointer to that NUL-terminated string in malloc'd storage.