See From 0507dfad5f060161f01840067e1bb1615257b636 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Mon, 8 Jun 2015 17:27:56 +0200 Subject: [PATCH] Do not rely on PATH_MAX when reading a symlink target. * src/util.c (move_file, copy_file): Use 'fromst->st_size + 1' and 'tost->st_size + 1' for the allocation, and 'fromst->st_size' and 'tost->st_size' instead of PATH_MAX. Fixes compilation on GNU/Hurd. --- src/util.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/util.c b/src/util.c index 1cc08ba..67dbd3a 100644 --- a/src/util.c +++ b/src/util.c @@ -460,12 +460,12 @@ move_file (char const *from, bool *from_needs_removal, /* FROM contains the contents of the symlink we have patched; need to convert that back into a symlink. */ - char *buffer = xmalloc (PATH_MAX); + char *buffer = xmalloc (fromst->st_size + 1); int fd, size = 0, i; if ((fd = safe_open (from, O_RDONLY | O_BINARY, 0)) < 0) pfatal ("Can't reopen file %s", quotearg (from)); - while ((i = read (fd, buffer + size, PATH_MAX - size)) > 0) + while ((i = read (fd, buffer + size, fromst->st_size - size)) > 0) size += i; if (i != 0 || close (fd) != 0) read_fatal (); @@ -610,10 +610,10 @@ copy_file (char const *from, char const *to, struct stat *tost, if (S_ISLNK (mode)) { - char *buffer = xmalloc (PATH_MAX + 1); + char *buffer = xmalloc (tost->st_size + 1); ssize_t r; - if ((r = safe_readlink (from, buffer, PATH_MAX)) < 0) + if ((r = safe_readlink (from, buffer, tost->st_size)) < 0) pfatal ("Can't read %s %s", "symbolic link", from); buffer[r] = '\0'; if (safe_symlink (buffer, to) != 0) -- 2.16.2 er'>committer
AgeCommit message (Expand)Author
2022-02-16gnu: debian-ports-archive-keyring: Update to 2022.02.15....* gnu/packages/debian.scm (debian-ports-archive-keyring): Update to 2022.02.15. Efraim Flashner
2022-01-12gnu: debian-ports-archive-keyring: Update to 2021.12.30....* gnu/packages/debian.scm (debian-ports-archive-keyring): Update to 2021.12.30. Efraim Flashner
2021-12-16gnu: dpkg: Update to 1.21.0....* gnu/packages/debian.scm (dpkg): Update to 1.21.0. [arguments]: Don't explicitly return #t from phases. Tobias Geerinckx-Rice
2021-12-13gnu: Further simplify package inputs....This is the result of running: ./pre-inst-env guix style --input-simplification=safe and manually undoing changes on a dozen of packages to reduce rebuilds (derivations for emacs, icecat, and libreoffice are unchanged.) Ludovic Courtès
2021-12-13gnu: Simplify package inputs....This commit was obtained by running: ./pre-inst-env guix style without any additional argument. Ludovic Courtès
2021-11-09gnu: debianutils: Update to 5.5-1....* gnu/packages/debian.scm (debianutils): Update to 5.5-1. [arguments]: Remove custom 'create-translations phase. Efraim Flashner
2021-11-09gnu: debootstrap: Update to 1.0.126....* gnu/packages/debian.scm (debootstrap): Update to 1.0.126. Efraim Flashner
2021-10-10gnu: Add debian-ports-archive-keyring: New variable....* gnu/packages/debian.scm (debian-ports-archive-keyring): New variable. Efraim Flashner