summaryrefslogtreecommitdiff
path: root/lib/areadlinkat-with-size.c
Commit message (Collapse)AuthorAgeFilesLines
* maint: run 'make update-copyright'Simon Josefsson2023-01-011-1/+1
|
* license: fix GPLv3 texts to use a comma instead of semicolon.Bernhard Voelker2022-01-051-1/+1
| | | | | | | | | See: https://www.gnu.org/licenses/gpl-3.0.html#howto Run: $ git grep -l 'Foundation; either version 3' \ | xargs sed -i '/Foundation; either version 3/ s/n; e/n, e/' * All files using GPLv3: Adjust via the above command.
* maint: run 'make update-copyright'Paul Eggert2022-01-011-1/+1
|
* free-posix: use more often in other modulesPaul Eggert2021-03-251-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This lets us simplify cleanup code that calls ‘free’. * lib/amemxfrm.c (amemxfrm): * lib/areadlink-with-size.c (areadlink_with_size): * lib/areadlinkat-with-size.c (areadlinkat_with_size): * lib/astrxfrm.c (astrxfrm): * lib/dprintf.c (dprintf): * lib/execute.c (execute): * lib/execvpe.c (execvpe): * lib/fchdir.c (get_name): * lib/file-has-acl.c (file_has_acl): * lib/fprintf.c (fprintf): * lib/getcwd-lgpl.c (rpl_getcwd): * lib/getgroups.c (rpl_getgroups): * lib/link.c (link, rpl_link): * lib/linkat.c (link_immediate, link_follow, linkat_follow): * lib/localename.c (newlocale, duplocale): * lib/mgetgroups.c (mgetgroups): * lib/mountlist.c (read_file_system_list): * lib/pipe-filter-gi.c (pipe_filter_gi_close): * lib/putenv.c (_unsetenv, putenv): * lib/read-file.c (read_file): * lib/rename.c (rpl_rename): * lib/savedir.c (streamsavedir, savedir): * lib/spawni.c (do_open, __spawni): * lib/spawn-pipe.c (create_pipe): * lib/striconv.c (mem_cd_iconv, str_cd_iconv, str_iconv): * lib/striconveh.c (mem_cd_iconveh_internal, str_cd_iconveh) (mem_iconveh, str_iconveh): * lib/supersede.c (open_supersede, close_supersede): * lib/vasnprintf.c (VASNPRINTF): * lib/vdprintf.c (vdprintf): * lib/vfprintf.c (vfprintf): * lib/wcscoll-impl.h (wcscoll): * lib/wcsxfrm-impl.h (wcsxfrm): * lib/xgetdomainname.c (xgetdomainname): * lib/xgethostname.c (xgethostname): Simplify by assuming that ‘free’ preserves errno. * lib/localename.c: Do not include errno.h. * modules/amemxfrm, modules/areadlink-with-size: * modules/areadlinkat-with-size, modules/astrxfrm: * modules/c-vasnprintf, modules/dprintf, modules/execute: * modules/execvpe, modules/fchdir, modules/file-has-acl: * modules/fprintf-posix, modules/getcwd-lgpl, modules/getgroups: * modules/link, modules/linkat, modules/localename: * modules/mgetgroups, modules/mountlist, modules/pipe-filter-gi: * modules/posix_spawn-internal, modules/putenv, modules/read-file: * modules/rename, modules/savedir, modules/spawn-pipe: * modules/striconv, modules/striconveh, modules/supersede: * modules/vasnprintf, modules/vdprintf, modules/vfprintf-posix: * modules/wcscoll, modules/wcsxfrm, modules/xgetdomainname: * modules/xgethostname: Depend on free-posix.
* maint: run 'make update-copyright'Paul Eggert2020-12-311-1/+1
|
* Assume readlink/readlinkat ERANGE fixPaul Eggert2020-12-131-3/+1
| | | | | | | | * lib/areadlink-with-size.c (areadlink_with_size): * lib/areadlinkat-with-size.c (areadlinkat_with_size): * lib/careadlinkat.c (readlink_stk): Do not worry about readlink or readlinkat failing with errno == ERANGE, since the Gnulib readlink and readlinkat modules now fix that.
* areadlink-with-size: Set errno upon failure.Bruno Haible2020-06-271-0/+2
| | | | | | * lib/areadlink-with-size.c (areadlink_with_size): Set errno when malloc fails. * lib/areadlinkat-with-size.c (areadlinkat_with_size): Add comment.
* maint: Run 'make update-copyright'Paul Eggert2019-12-311-1/+1
|
* areadlink-with-size, xgethostname, xgetdomainname: Fix GCC warning.Bruno Haible2019-07-191-0/+1
| | | | | | | * lib/areadlink-with-size.c: Include <string.h>. * lib/areadlinkat-with-size.c: Likewise. * lib/xgethostname.c: Likewise. * lib/xgetdomainname.c: Likewise.
* areadlink-with-size: avoid realloc when size==0Paul Eggert2019-07-061-8/+23
| | | | | | | | | * lib/areadlink-with-size.c (areadlink_with_size): * lib/areadlinkat-with-size.c (areadlinkat_with_size): Reallocate at the end to the actual size, to avoid memory waste, as suggested by Bruno Haible. But when the guessed size is zero - useful when the size is unknown - do the initial small readlink into the stack, to avoid that realloc in the usual case.
* areadlink-with-size: guess a buffer size with 0 sizePádraig Brady2019-07-061-1/+2
| | | | | | | | | | | | | | | | | | | The size is usually taken from st_size, which can be zero, resulting in inefficient operation as seen with: $ strace -e readlink stat -c %N /proc/$$/cwd readlink("/proc/9036/cwd", "/", 1) = 1 readlink("/proc/9036/cwd", "/h", 2) = 2 readlink("/proc/9036/cwd", "/hom", 4) = 4 readlink("/proc/9036/cwd", "/home/pa", 8) = 8 readlink("/proc/9036/cwd", "/home/padraig", 16) = 13 Instead let zero select an initial memory allocation of 128 bytes, which most symlinks fit within. * lib/areadlink-with-size.c (areadlink_with_size): Start with a 128 byte buffer, for SIZE == 0. * lib/areadlinkat-with-size.c (areadlinkat_with_size): Likewise.
* areadlinkat-with-size: Don't return an excessive memory allocation.Bruno Haible2019-07-061-0/+7
| | | | | * lib/areadlinkat-with-size.c (areadlinkat_with_size): Shrink the buffer before returning it.
* maint: Run 'make update-copyright'Paul Eggert2019-01-011-1/+1
|
* maint: Run 'make update-copyright'Paul Eggert2018-01-011-1/+1
|
* all: prefer https: URLsPaul Eggert2017-09-131-1/+1
|
* version-etc: new yearPaul Eggert2017-01-011-1/+1
| | | | | | | | | | * build-aux/gendocs.sh (version): * doc/gendocs_template: * doc/gendocs_template_min: * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright dates by hand in templates and the like. * all files: Run 'make update-copyright'.
* version-etc: new yearPaul Eggert2016-01-011-1/+1
| | | | | | | | | | * build-aux/gendocs.sh (version): * doc/gendocs_template: * doc/gendocs_template_min: * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright dates by hand in templates and the like. * all files: Run 'make update-copyright'.
* version-etc: new yearPaul Eggert2014-12-311-1/+1
| | | | | | * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright date. * all files: Run 'make update-copyright'.
* maint: update copyrightEric Blake2014-01-011-1/+1
| | | | | | I ran 'make update-copyright'. Signed-off-by: Eric Blake <eblake@redhat.com>
* maint: update all copyright year number rangesEric Blake2013-01-011-1/+1
| | | | | | Run "make update-copyright". Compare to commit 1602f0a from last year. Signed-off-by: Eric Blake <eblake@redhat.com>
* maint: update all copyright year number rangesJim Meyering2012-01-011-1/+1
| | | | Run "make update-copyright".
* maint: update almost all copyright ranges to include 2011Jim Meyering2011-01-011-1/+1
| | | | Run the new "make update-copyright" rule.
* update nearly all FSF copyright year lists to include 2010Jim Meyering2010-01-011-1/+1
| | | | | Use the same procedure as for 2009, outlined in http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/20081
* areadlink: use SIZE_MAX consistentlyEric Blake2009-10-081-2/+1
| | | | | | | | | | | | | | | | | * modules/areadlink (Depends-on): Add stdint. * modules/areadlink-with-size (Depends-on): Likewise. * lib/areadlink-with-size.c (includes): Drop stdio, since stdlib gives NULL; drop sys/types, since unistd gives size_t; and add stdint for SIZE_MAX. (SIZE_MAX): Rely on headers. * lib/areadlinkat-with-size.c (includes): Drop stdio, sys/types, and add stdint. * lib/areadlink.c (includes): Drop sys/types, and add stdint. (SIZE_MAX): Likewise. (INITIAL_BUF_SIZE): Turn into enum. * lib/areadlinkat.c (INITIAL_BUF_SIZE): Likewise. Signed-off-by: Eric Blake <ebb9@byu.net>
* areadlinkat-with-size: new moduleEric Blake2009-10-071-0/+133
* modules/areadlinkat-with-size: New module. * lib/areadlinkat-with-size.c (areadlinkat_with_size): New file. * lib/areadlink.h (areadlinkat): Declare it. * MODULES.html.sh (File system functions): Mention it. * modules/areadlinkat-with-size-tests: New test. * tests/test-areadlinkat-with-size.c: New file. Signed-off-by: Eric Blake <ebb9@byu.net>