1
Description: Replace unconditional use of PATH_MAX
2
The patch below fixes an unconditional use of PATH_MAX which causes the
3
GNU/Hurd platform to fail to build from source the memcached package.
5
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=637695
6
Author: Svante Signell <svante.signell@telia.com>
7
Reviewed-by: Arno Töll <debian@toell.net>
8
Last-Update: 2011-09-15
14
/* FreeBSD 4.x doesn't have IOV_MAX exposed. */
16
-#if defined(__FreeBSD__) || defined(__APPLE__)
17
+#if defined(__FreeBSD__) || defined(__APPLE__) || defined(__GNU__)
21
@@ -4793,12 +4793,15 @@
22
/* create the listening socket, bind it, and init */
23
if (settings.socketpath == NULL) {
24
const char *portnumber_filename = getenv("MEMCACHED_PORT_FILENAME");
25
- char temp_portnumber_filename[PATH_MAX];
26
+ char *temp_portnumber_filename = NULL;
28
FILE *portnumber_file = NULL;
30
if (portnumber_filename != NULL) {
31
+ len = strlen(portnumber_filename)+4+1;
32
+ temp_portnumber_filename = malloc(len);
33
snprintf(temp_portnumber_filename,
34
- sizeof(temp_portnumber_filename),
36
"%s.lck", portnumber_filename);
38
portnumber_file = fopen(temp_portnumber_filename, "a");
40
if (portnumber_file) {
41
fclose(portnumber_file);
42
rename(temp_portnumber_filename, portnumber_filename);
43
+ free(temp_portnumber_filename);