summaryrefslogtreecommitdiff
path: root/debian/patches/solve_PATH_MAX_issue.patch
blob: 4f860e9dda05d7a366ab3203513fba203129ba0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
From: =?utf-8?b?SMOpY3RvciBPcsOzbiBNYXJ0w61uZXo=?= <zumbi@debian.org>
Date: Wed, 20 Feb 2019 13:25:36 +0100
Subject: Patch out a PATH_MAX usage, for Hurd's benefit
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit

Author: Svante Signell <svante.signell@gmail.com>
Bug-Debian: http://bugs.debian.org/709508
Forwarded: http://sourceware.org/ml/gdb-patches/2013-05/msg00878.html
Reviewed-By: Héctor Orón Martínez <zumbi@debian.org>
Last-Update: 2013-06-08
---
 gdb/nto-tdep.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/gdb/nto-tdep.c b/gdb/nto-tdep.c
index 82a4fcb..12923fc 100644
--- a/gdb/nto-tdep.c
+++ b/gdb/nto-tdep.c
@@ -155,10 +155,12 @@ nto_find_and_open_solib (const char *solib, unsigned o_flags,
 void
 nto_init_solib_absolute_prefix (void)
 {
-  char buf[PATH_MAX * 2], arch_path[PATH_MAX];
+  char *buf, *arch_path;
   char *nto_root;
   const char *endian;
   const char *arch;
+  int arch_len, len;
+#define FMT "set solib-absolute-prefix %s"
 
   nto_root = nto_target ();
   if (strcmp (gdbarch_bfd_arch_info (target_gdbarch ())->arch_name, "i386") == 0)
@@ -181,9 +183,13 @@ nto_init_solib_absolute_prefix (void)
 	       == BFD_ENDIAN_BIG ? "be" : "le";
     }
 
-  xsnprintf (arch_path, sizeof (arch_path), "%s/%s%s", nto_root, arch, endian);
+  arch_len = strlen (nto_root) + 1 + strlen (arch) + strlen (endian) + 1;
+  arch_path = alloca (arch_len);
+  xsnprintf (arch_path, arch_len, "%s/%s%s", nto_root, arch, endian);
 
-  xsnprintf (buf, sizeof (buf), "set solib-absolute-prefix %s", arch_path);
+  len = strlen (FMT) - 2 + strlen (arch_path) + 1;
+  buf =  alloca (len);
+  xsnprintf (buf, len, FMT, arch_path);
   execute_command (buf, 0);
 }