| 1 |
## 38_hurd.patch by <[email protected]> |
| 2 |
## |
| 3 |
## All lines beginning with `## DP:' are a description of the patch. |
| 4 |
## DP: Fix FTBFS on Hurd because of MAXPATHLEN |
| 5 |
|
| 6 |
Index: nss/nss/cmd/shlibsign/shlibsign.c |
| 7 |
=================================================================== |
| 8 |
--- nss.orig/nss/cmd/shlibsign/shlibsign.c |
| 9 |
+++ nss/nss/cmd/shlibsign/shlibsign.c |
| 10 |
@@ -1260,7 +1260,6 @@ main(int argc, char **argv) |
| 11 |
#ifdef USES_LINKS |
| 12 |
int ret; |
| 13 |
struct stat stat_buf; |
| 14 |
- char link_buf[MAXPATHLEN + 1]; |
| 15 |
char *link_file = NULL; |
| 16 |
#endif |
| 17 |
|
| 18 |
@@ -1511,10 +1510,22 @@ main(int argc, char **argv) |
| 19 |
} |
| 20 |
if (S_ISLNK(stat_buf.st_mode)) { |
| 21 |
char *dirpath, *dirend; |
| 22 |
- ret = readlink(input_file, link_buf, sizeof(link_buf) - 1); |
| 23 |
- if (ret < 0) { |
| 24 |
- perror(input_file); |
| 25 |
- goto cleanup; |
| 26 |
+ char *link_buf = NULL; |
| 27 |
+ size_t size = 64; |
| 28 |
+ while (1) { |
| 29 |
+ link_buf = realloc(link_buf, size); |
| 30 |
+ if (!link_buf) { |
| 31 |
+ perror(input_file); |
| 32 |
+ goto cleanup; |
| 33 |
+ } |
| 34 |
+ ret = readlink(input_file, link_buf, size - 1); |
| 35 |
+ if (ret < 0) { |
| 36 |
+ perror(input_file); |
| 37 |
+ goto cleanup; |
| 38 |
+ } |
| 39 |
+ if (ret < size - 1) |
| 40 |
+ break; |
| 41 |
+ size *= 2; |
| 42 |
} |
| 43 |
link_buf[ret] = 0; |
| 44 |
link_file = mkoutput(input_file); |
| 45 |
Index: nss/nss/lib/freebl/unix_rand.c |
| 46 |
=================================================================== |
| 47 |
--- nss.orig/nss/lib/freebl/unix_rand.c |
| 48 |
+++ nss/nss/lib/freebl/unix_rand.c |
| 49 |
@@ -756,6 +756,10 @@ RNG_FileForRNG(const char *fileName) |
| 50 |
#define _POSIX_PTHREAD_SEMANTICS |
| 51 |
#include <dirent.h> |
| 52 |
|
| 53 |
+#ifndef PATH_MAX |
| 54 |
+#define PATH_MAX 1024 |
| 55 |
+#endif |
| 56 |
+ |
| 57 |
PRBool |
| 58 |
ReadFileOK(char *dir, char *file) |
| 59 |
{ |