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 >
AgeCommit message (Expand)Author
2023-08-28gnu: Add gdb-multiarch....* gnu/packages/gdb.scm (gdb-multiarch): New variable. 宋文武
2023-06-17gnu: Use target-hurd?, system-hurd? instead of hurd-target?, hurd-system?....* gnu/packages/hurd.scm (hurd-target?): Remove. (hurd-system?): Move to... * guix/utils.scm (system-hurd?): ...here. * gnu/packages/*: Update all users, removing (gnu packages hurd) include where now unused. Janneke Nieuwenhuizen
2023-05-07gnu: gdb/pinned: Move to gdb-12.1....* gnu/packages/gdb.scm (gdb/pinned): Refer to gdb-12.1. [properties]: Hide the package. (gdb-12): Inherit from gdb/pinned. Efraim Flashner
2023-04-18gnu: gdb: Change default to 12.x....* gnu/packages/gdb.scm (gdb): Change to GDB-12. Ludovic Courtès
2023-04-18gnu: gdb: Distinguish between the "pinned" and the "default" version....* gnu/packages/gdb.scm (gdb/pinned): New variable. * gnu/packages/rust.scm (rust)[native-inputs]: Use it instead of GDB. Ludovic Courtès
2023-04-18gnu: gdb: Remove Hurd patch....The patch was useful for GDB 11 on the previous Hurd version that was used; it's unnecessary on GDB 12 and GDB 11 has other build issues on the current GNU/Hurd. This change fixes "guix build gdb-minimal --target=i586-pc-gnu". * gnu/packages/patches/gdb-fix-gnu-nat-build.patch: Remove. * gnu/local.mk (dist_patch_DATA): Remove it. * gnu/packages/gdb.scm (gdb-11)[arguments]: Remove 'patch-gdb/hurd' phase. [inputs]: Remove "hurd-build.patch" input. [supported-systems]: New field. (gdb-12)[supported-systems]: New field. Ludovic Courtès
2023-04-18gnu: gdb-minimal: Update to 12.x....* gnu/packages/gdb.scm (gdb-minimal): Rebase on GDB-12. Ludovic Courtès
2023-04-18gnu: gdb: Use 'cross-mig' when targeting GNU/Hurd....This is a followup to 2756d662aa27cf55f3224e4a0a9e08c1be2cc551. * gnu/packages/gdb.scm (gdb-11)[native-inputs]: Use 'cross-mig' instead of 'mig/32-bit'. Ludovic Courtès
2022-11-07gnu: Add avr-gdb....* gnu/packages/gdb.scm (avr-gdb): New variable. Signed-off-by: Christopher Baines <mail@cbaines.net> Kristian Lein-Mathisen
2022-08-03gnu: Add gdb-12....* gnu/packages/gdb.scm (gdb-12): New variable. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Greg Hogan