|
|
| version 1.1.1.1, 2012/05/29 09:29:43 | version 1.1.1.2, 2021/03/17 13:38:46 |
|---|---|
| Line 1 | Line 1 |
| /* Read symbolic links into a buffer without size limitation, relative to fd. | /* Read symbolic links into a buffer without size limitation, relative to fd. |
| Copyright (C) 2001, 2003-2004, 2007, 2009-2011 Free Software Foundation, | Copyright (C) 2001, 2003-2004, 2007, 2009-2019 Free Software Foundation, |
| Inc. | Inc. |
| This program is free software: you can redistribute it and/or modify | This program is free software: you can redistribute it and/or modify |
| Line 14 | Line 14 |
| GNU General Public License for more details. | GNU General Public License for more details. |
| You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License |
| along with this program. If not, see <http://www.gnu.org/licenses/>. */ | along with this program. If not, see <https://www.gnu.org/licenses/>. */ |
| /* Written by Paul Eggert, Bruno Haible, and Jim Meyering. */ | /* Written by Paul Eggert, Bruno Haible, and Jim Meyering. */ |
| Line 24 | Line 24 |
| #include <errno.h> | #include <errno.h> |
| #include <limits.h> | #include <limits.h> |
| #include <stdlib.h> | |
| #include <string.h> | #include <string.h> |
| #include <unistd.h> | #include <unistd.h> |
| Line 38 | Line 37 |
| #endif | #endif |
| #include "allocator.h" | #include "allocator.h" |
| /* 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. */ | |
| 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 for which it was not meant for. */ | |
| if (fd != AT_FDCWD) | |
| abort (); | |
| return readlink (filename, buffer, buffer_size); | |
| } | |
| /* Assuming the current directory is FD, get the symbolic link value | /* Assuming the current directory is FD, get the symbolic link value |
| of FILENAME as a null-terminated string and put it into a buffer. | of FILENAME as a null-terminated string and put it into a buffer. |