~john-koepi/ubuntu/trusty/memcached/default

« back to all changes in this revision

Viewing changes to debian/patches/03_fix_ftbfs4hurd.patch

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2011-10-05 13:27:39 UTC
  • mfrom: (1.1.8 upstream) (3.3.4 sid)
  • Revision ID: james.westby@ubuntu.com-20111005132739-ntsnlj16fcze221i
Tags: 1.4.7-0.1ubuntu1
* Merge from debian unstable.  Remaining changes:
  - Run as 'memcache' user instead of nobody (LP #599461)
  - Depend on adduser for preinst/postrm
  - Create user in postinst

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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.
 
4
Forwarded: no
 
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
 
9
 
 
10
--- a/memcached.c
 
11
+++ b/memcached.c
 
12
@@ -49,7 +49,7 @@
 
13
 
 
14
 /* FreeBSD 4.x doesn't have IOV_MAX exposed. */
 
15
 #ifndef IOV_MAX
 
16
-#if defined(__FreeBSD__) || defined(__APPLE__)
 
17
+#if defined(__FreeBSD__) || defined(__APPLE__) || defined(__GNU__)
 
18
 # define IOV_MAX 1024
 
19
 #endif
 
20
 #endif
 
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;
 
27
+        size_t len;
 
28
         FILE *portnumber_file = NULL;
 
29
 
 
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),
 
35
+                     len,
 
36
                      "%s.lck", portnumber_filename);
 
37
 
 
38
             portnumber_file = fopen(temp_portnumber_filename, "a");
 
39
@@ -4833,6 +4836,7 @@
 
40
         if (portnumber_file) {
 
41
             fclose(portnumber_file);
 
42
             rename(temp_portnumber_filename, portnumber_filename);
 
43
+            free(temp_portnumber_filename);
 
44
         }
 
45
     }
 
46