Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: limited pathconf support revisited



This should unbreak 12472 for filesystems where _PC_PATH_MAX is undefined.

Index: Src/Modules/files.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/files.c,v
retrieving revision 1.2
diff -u -r1.2 files.c
--- Src/Modules/files.c	2000/08/02 13:54:17	1.2
+++ Src/Modules/files.c	2000/08/02 14:01:45
@@ -95,12 +95,13 @@
 	while(ptr > *args + (**args == '/') && *--ptr == '/')
 	    *ptr = 0;
 #ifdef HAVE_PATHCONF
-	if((pathmax = pathconf(*args,_PC_PATH_MAX)) == -1) {
+	errno = 0;
+	if(((pathmax = pathconf(*args,_PC_PATH_MAX)) == -1) && errno) {
 	  zwarnnam(nam, "%s: %e", *args, errno);
 	  err = 1;
 	  continue;
 	}
-	else if(ztrlen(*args) > pathmax - 1) {
+	else if((ztrlen(*args) > pathmax - 1) && errno != -1) {
 #else
 	  if(ztrlen(*args) > PATH_MAX - 1) {
 #endif
Index: Src/Modules/parameter.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/parameter.c,v
retrieving revision 1.12
diff -u -r1.12 parameter.c
--- Src/Modules/parameter.c	2000/08/02 13:54:18	1.12
+++ Src/Modules/parameter.c	2000/08/02 14:01:50
@@ -1400,11 +1400,13 @@
 #ifdef HAVE_PATHCONF
     int pathmax = 0;
 
+    errno = 0;
     pathmax = pathconf(value, _PC_PATH_MAX);
-    if (pathmax == -1) {
+    if ((pathmax == -1) && errno) {
       zwarn("%s: %e", value, errno);
     }
-    else if (!value || *value != '/' || strlen(value) >= pathmax)
+    else if (!value || *value != '/' || ((strlen(value) >= pathmax) &&
+            pathmax != -1))
 #else
     if (!value || *value != '/' || strlen(value) >= PATH_MAX)
 #endif
@@ -1456,7 +1458,8 @@
 	    v.pm = (Param) hn;
 
 #ifdef HAVE_PATHCONF
-            if((pathmax = pathconf(val, _PC_PATH_MAX)) == -1)
+	    errno = 0;
+            if((((pathmax = pathconf(val, _PC_PATH_MAX)) == -1)) && errno)
                 zwarn("%s: %e", val, errno);
             else
 #endif
@@ -1464,7 +1467,7 @@
 #ifdef HAVE_PATHCONF
 		strlen(val) >= PATH_MAX)
 #else
-                strlen(val) >= pathmax)
+                ((strlen(val) >= pathmax)) && pathmax != -1)
 #endif
 		zwarn("invalid value: %s", val, 0);
 	    else

----- End forwarded message -----



Messages sorted by: Reverse Date, Date, Thread, Author