ef11ad850abf574a711938786d3f0cc04f6f7127
1800812+nathanweeks
  Fri Jul 24 05:28:31 2020 -0500
Use POSIX pathconf() instead of BSD MAXNAMLEN

diff --git src/lib/udc.c src/lib/udc.c
index a6b29f9..a67b1dc 100644
--- src/lib/udc.c
+++ src/lib/udc.c
@@ -989,48 +989,48 @@
 *retProtocol = protocol;
 *retAfterProtocol = afterProtocol;
 *retColon = colon;
 }
 
 void udcParseUrl(char *url, char **retProtocol, char **retAfterProtocol, char **retColon)
 /* Parse the URL into components that udc treats separately.
  * *retAfterProtocol is Q-encoded to keep special chars out of filenames.  
  * Free  *retProtocol and *retAfterProtocol but not *retColon when done. */
 {
 udcParseUrlFull(url, retProtocol, retAfterProtocol, retColon, NULL);
 }
 
 static void addElementToDy(struct dyString *dy, char *name)
 /* add one element of a path to a dyString, hashing it if it's longer 
- * than MAXNAMLEN */
+ * than NAME_MAX */
 {
-if (strlen(name) > MAXNAMLEN)
+if (strlen(name) > pathconf(name, _PC_NAME_MAX))
     {
     unsigned char hash[SHA_DIGEST_LENGTH];
     char newName[(SHA_DIGEST_LENGTH + 1) * 2];
 
     SHA1((const unsigned char *)name, strlen(name), hash);
     hexBinaryString(hash,  SHA_DIGEST_LENGTH, newName, (SHA_DIGEST_LENGTH + 1) * 2);
     
     dyStringAppend(dy, newName);
     }
 else
     dyStringAppend(dy, name);
 }
 
 static char *longDirHash(char *name)
-/* take a path and hash the elements that are longer than MAXNAMLEN */
+/* take a path and hash the elements that are longer than NAME_MAX */
 {
 struct dyString *dy = newDyString(strlen(name));
 char *ptr = strchr(name, '/');
 
 while(ptr)
     {
     *ptr = 0;
     addElementToDy(dy, name);
 
     dyStringAppend(dy, "/");
 
     name = ptr + 1;
     ptr = strchr(name, '/');
     }