[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#637695: memcached: Fix FTBFS on hurd-i386



Package: memcached
Version: 1.4.5-1
Severity: important
Tags: patch
User: debian-hurd@lists.debian.org
Usertags: hurd

The attached patch fixes the FTBFS problem for GNU/HUrd, and at the
same time makes the PATH_MAX definition redundant for all
architectures. Connected with the patch for bug #625397 memcached
builds perfectly on GNU/Hurd with gcc-4.6.

Thanks

--- memcached-1.4.5/memcached.c	2010-04-03 21:51:29.000000000 +0200
+++ memcached-1.4.5.modified/memcached.c	2011-08-13 20:08:05.000000000 +0200
@@ -49,7 +49,7 @@
 
 /* FreeBSD 4.x doesn't have IOV_MAX exposed. */
 #ifndef IOV_MAX
-#if defined(__FreeBSD__) || defined(__APPLE__)
+#if defined(__FreeBSD__) || defined(__APPLE__) || defined(__GNU__)
 # define IOV_MAX 1024
 #endif
 #endif
@@ -4630,12 +4630,15 @@
         int udp_port;
 
         const char *portnumber_filename = getenv("MEMCACHED_PORT_FILENAME");
-        char temp_portnumber_filename[PATH_MAX];
+        char *temp_portnumber_filename = NULL;
+        size_t len;
         FILE *portnumber_file = NULL;
 
         if (portnumber_filename != NULL) {
+            len = strlen(portnumber_filename)+4+1;
+            temp_portnumber_filename = malloc(len);
             snprintf(temp_portnumber_filename,
-                     sizeof(temp_portnumber_filename),
+                     len,
                      "%s.lck", portnumber_filename);
 
             portnumber_file = fopen(temp_portnumber_filename, "a");
@@ -4671,6 +4674,7 @@
         if (portnumber_file) {
             fclose(portnumber_file);
             rename(temp_portnumber_filename, portnumber_filename);
+            free(temp_portnumber_filename);
         }
     }
 

Reply to: