From: Mike Hommey Date: Mon, 13 Jan 2014 03:00:25 +0000 (+0900) Subject: Fix FTBFS on Hurd because of MAXPATHLEN X-Git-Tag: archive/raspbian/60.4.0esr-1+rpi1~1^2^2~17 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=855084e92e47968af86e24f4948ec83dcf0fa843;p=firefox-esr.git Fix FTBFS on Hurd because of MAXPATHLEN Gbp-Pq: Topic porting Gbp-Pq: Name NSS-Fix-FTBFS-on-Hurd-because-of-MAXPATHLEN.patch --- diff --git a/security/nss/cmd/shlibsign/shlibsign.c b/security/nss/cmd/shlibsign/shlibsign.c index 7ddbf343dfe..48e1aae3172 100644 --- a/security/nss/cmd/shlibsign/shlibsign.c +++ b/security/nss/cmd/shlibsign/shlibsign.c @@ -716,7 +716,6 @@ int main(int argc, char **argv) #ifdef USES_LINKS int ret; struct stat stat_buf; - char link_buf[MAXPATHLEN+1]; char *link_file = NULL; #endif @@ -1044,10 +1043,22 @@ int main(int argc, char **argv) } if (S_ISLNK(stat_buf.st_mode)) { char *dirpath,*dirend; - ret = readlink(input_file, link_buf, sizeof(link_buf) - 1); - if (ret < 0) { - perror(input_file); - goto cleanup; + char *link_buf = NULL; + size_t size = 64; + while (1) { + link_buf = realloc(link_buf, size); + if (!link_buf) { + perror(input_file); + goto cleanup; + } + ret = readlink(input_file, link_buf, size - 1); + if (ret < 0) { + perror(input_file); + goto cleanup; + } + if (ret < size - 1) + break; + size *= 2; } link_buf[ret] = 0; link_file = mkoutput(input_file); diff --git a/security/nss/lib/freebl/unix_rand.c b/security/nss/lib/freebl/unix_rand.c index 579040eea8e..b4fef7a08f9 100644 --- a/security/nss/lib/freebl/unix_rand.c +++ b/security/nss/lib/freebl/unix_rand.c @@ -1031,6 +1031,10 @@ void ReadSingleFile(const char *fileName) #define _POSIX_PTHREAD_SEMANTICS #include +#ifndef PATH_MAX +#define PATH_MAX 1024 +#endif + PRBool ReadFileOK(char *dir, char *file) {