File: 0001-Avoid-using-PATH_MAX-for-GNU-Hurd.patch

package info (click to toggle)
ruby-posix-spawn 0.3.11-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 244 kB
  • ctags: 163
  • sloc: ruby: 1,057; ansic: 310; makefile: 5
file content (27 lines) | stat: -rw-r--r-- 823 bytes parent folder | download | duplicates (2)
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
From: Youhei SASAKI <uwabami@gfd-dennou.org>
Date: Wed, 4 Jun 2014 01:57:22 +0900
Subject: Avoid using PATH_MAX for GNU/Hurd
Origin: Svante Signell <svante.signell@gmail.com>

Signed-off-by: Youhei SASAKI <uwabami@gfd-dennou.org>
---
 ext/posix-spawn.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

--- ruby-posix-spawn.orig/ext/posix-spawn.c
+++ ruby-posix-spawn/ext/posix-spawn.c
@@ -462,8 +462,12 @@
 	}
 
 	if (ret != 0) {
-		char error_context[PATH_MAX+32];
-		snprintf(error_context, sizeof(error_context), "when spawning '%s'", file);
+		char *error_context = NULL;
+		size_t len = 15 + strlen(file) + 1 + 1;
+		error_context = malloc(len);
+		if (error_context == NULL)
+		  return -1;
+		snprintf(error_context, len, "when spawning '%s'", file);
 		errno = ret;
 		rb_sys_fail(error_context);
 	}