#48640 [Asn]: compilation broken for NetWare because of wrong ifdefs

From: Date: Tue, 23 Jun 2009 23:24:36 +0000
Subject: #48640 [Asn]: compilation broken for NetWare because of wrong ifdefs
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-138738@lists.php.net to get a copy of this message
 ID:               48640
 User updated by:  guenter@php.net
 Reported By:      guenter@php.net
 Status:           Assigned
 Bug Type:         Zip Related
 Operating System: NetWare
 PHP Version:      5.2.10
 Assigned To:      guenter
 New Comment:

Here's a 'diff -wu php_zip.c.orig php_zip.c' which probably shows
better what the patch really does:
http://www.gknw.net/~gknw/php_zip.c.diff.html


Previous Comments:
------------------------------------------------------------------------

[2009-06-23 13:52:30] pajoye@php.net

Pls commit yourself :)

------------------------------------------------------------------------

[2009-06-23 12:44:09] pajoye@php.net

Ilia, he can commit himself now. Afaics, this patch is only a cleanup
for other platforms, where the #ifdef clauses contain the same code.

------------------------------------------------------------------------

[2009-06-23 12:39:47] iliaa@php.net

Why are the win32 defines being removed in the patch?

------------------------------------------------------------------------

[2009-06-22 10:49:01] guenter@php.net

Description:
------------
compilation breaks in php_zip.c function php_zip_realpath_r() because
of wrong ifdefs for NetWare which leads to a missing brace.
Although its sufficient to remove the code lines 157-161 I strongly
suggest to cleanup the function code since the rest of ifdefs is very
confusing. Please apply the patch below to a copy of php_zip.c and
compare the result against the current code to verify the patch --
reading the diff properly might be _very_ confusing!

--- php_zip.c.orig	Thu Feb 05 20:53:22 2009
+++ php_zip.c	Fri Mar 27 10:31:02 2009
@@ -148,51 +148,28 @@
 			}
 			return j;
 		}
-	
-		path[len] = 0;
 
-#ifdef PHP_WIN32
-		tmp = tsrm_do_alloca(len+1);
-		memcpy(tmp, path, len+1);
-#elif defined(NETWARE)
+		path[len] = 0;
 
 		tmp = tsrm_do_alloca(len+1);
 		memcpy(tmp, path, len+1);
-#else
-		tmp = tsrm_do_alloca(len+1);
-		memcpy(tmp, path, len+1);
 
-		{
-#endif
-			if (i - 1 <= start) {
-				j = start;
-			} else {
-				/* some leading directories may be unaccessable */
-				j = php_zip_realpath_r(path, start, i-1, ll, t, use_realpath, 1,
NULL TSRMLS_CC);
-				if (j > start) {
-					path[j++] = DEFAULT_SLASH;
-				}
+		if (i - 1 <= start) {
+			j = start;
+		} else {
+			/* some leading directories may be unaccessable */
+			j = php_zip_realpath_r(path, start, i-1, ll, t, use_realpath, 1,
NULL TSRMLS_CC);
+			if (j > start) {
+				path[j++] = DEFAULT_SLASH;
 			}
-#ifdef PHP_WIN32
-			if (j < 0 || j + len - i >= MAXPATHLEN-1) {
-				tsrm_free_alloca(tmp);
-
-				return -1;
-			}
-			{
-				/* use the original file or directory name as it wasn't found */
-				memcpy(path+j, tmp+i, len-i+1);
-				j += (len-i);
-			}
-#else
-			if (j < 0 || j + len - i >= MAXPATHLEN-1) {
-				tsrm_free_alloca(tmp);
-				return -1;
-			}
-			memcpy(path+j, tmp+i, len-i+1);
-			j += (len-i);
 		}
-#endif
+		if (j < 0 || j + len - i >= MAXPATHLEN-1) {
+			tsrm_free_alloca(tmp);
+			return -1;
+		}
+		/* use the original file or directory name as it wasn't found */
+		memcpy(path+j, tmp+i, len-i+1);
+		j += (len-i);
 
 		tsrm_free_alloca(tmp);
 		return j;




------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=48640&edit=1



Thread (6 messages)

« previous php.bugs (#138738) next »