cvs: php4 / php.h php_virtual_cwd.c php_virtual_cwd.h /dl/log/ log_sql.c /ext/db/ db.c /ext/session/ mod_files.c /ext/standard/ file.c link.c

[email protected] ("Andi Gutmans")
Newsgroups php.version4
Message-ID <cvsandi959092588@cvsserver>
andi		Tue May 23 16:36:28 2000 EDT

  Modified files:
    /php4	php.h php_virtual_cwd.c php_virtual_cwd.h 
    /php4/dl/log	log_sql.c 
    /php4/ext/db	db.c 
    /php4/ext/session	mod_files.c 
    /php4/ext/standard	file.c link.c 
  Log:
  - Support virtual unlink() 
  
  
Index: php4/php.h
diff -u php4/php.h:1.93 php4/php.h:1.94
--- php4/php.h:1.93	Fri May 19 10:28:53 2000
+++ php4/php.h	Tue May 23 16:36:26 2000
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php.h,v 1.93 2000/05/19 08:28:53 zeev Exp $ */
+/* $Id: php.h,v 1.94 2000/05/23 14:36:26 andi Exp $ */
 
 #ifndef _PHP_H
 #define _PHP_H
@@ -308,6 +308,7 @@
 #else
 #define V_LSTAT(path, buff) virtual_lstat(path, buff)
 #endif
+#define V_UNLINK(path) virtual_unlink(path)
 #else
 #define V_GETCWD(buff, size) getcwd(buff,size)
 #define V_FOPEN(path, mode)  fopen(path, mode)
@@ -318,6 +319,7 @@
 #define V_GETWD(buf) getwd(buf)
 #define V_STAT(path, buff) stat(path, buff)
 #define V_LSTAT(path, buff) lstat(path, buff)
+#define V_UNLINK(path) unlink(path)
 #endif
 
 #include "zend_constants.h"
Index: php4/php_virtual_cwd.c
diff -u php4/php_virtual_cwd.c:1.44 php4/php_virtual_cwd.c:1.45
--- php4/php_virtual_cwd.c:1.44	Wed May 17 01:38:51 2000
+++ php4/php_virtual_cwd.c	Tue May 23 16:36:26 2000
@@ -471,6 +471,21 @@
 
 #endif
 
+CWD_API int virtual_unlink(const char *path)
+{
+	cwd_state new_state;
+	int retval;
+	CWDLS_FETCH();
+
+	CWD_STATE_COPY(&new_state, &CWDG(cwd));
+
+	virtual_file_ex(&new_state, path, NULL);
+
+	retval = unlink(new_state.cwd);
+	CWD_STATE_FREE(&new_state);
+	return retval;
+}
+
 #if 0
 
 main(void)
Index: php4/php_virtual_cwd.h
diff -u php4/php_virtual_cwd.h:1.21 php4/php_virtual_cwd.h:1.22
--- php4/php_virtual_cwd.h:1.21	Wed May 17 01:38:51 2000
+++ php4/php_virtual_cwd.h	Tue May 23 16:36:26 2000
@@ -48,6 +48,8 @@
 #ifndef ZEND_WIN32
 CWD_API int virtual_lstat(const char *path, struct stat *buf);
 #endif
+CWD_API int virtual_unlink(const char *path);
+
 CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func verify_path);
 
 ZEND_BEGIN_MODULE_GLOBALS(cwd)
Index: php4/dl/log/log_sql.c
diff -u php4/dl/log/log_sql.c:1.4 php4/dl/log/log_sql.c:1.5
--- php4/dl/log/log_sql.c:1.4	Sun Apr 30 21:01:15 2000
+++ php4/dl/log/log_sql.c	Tue May 23 16:36:26 2000
@@ -27,7 +27,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: log_sql.c,v 1.4 2000/04/30 19:01:15 andi Exp $ */
+/* $Id: log_sql.c,v 1.5 2000/05/23 14:36:26 andi Exp $ */
 
 #include "phpdl.h"
 
@@ -350,7 +350,7 @@
 #endif
 #endif
 #if MSQLLOGGING
-	unlink(lockfn);
+	V_UNLINK(lockfn);
 #endif
 	if (hs) host[63]=hs;
 	if (es) email[63]=es;
Index: php4/ext/db/db.c
diff -u php4/ext/db/db.c:1.36 php4/ext/db/db.c:1.37
--- php4/ext/db/db.c:1.36	Tue May 23 11:33:35 2000
+++ php4/ext/db/db.c	Tue May 23 16:36:27 2000
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: db.c,v 1.36 2000/05/23 09:33:35 sas Exp $ */
+/* $Id: db.c,v 1.37 2000/05/23 14:36:27 andi Exp $ */
 #define IS_EXT_MODULE
 #ifdef COMPILE_DL_DB
 # include "dl/phpdl.h"
@@ -399,7 +399,7 @@
 
 #if NFS_HACK
 		if (lockfn) {
-			unlink(lockfn);
+			V_UNLINK(lockfn);
 		}
 #endif
 		if (lockfn) efree(lockfn);
@@ -434,7 +434,7 @@
 	dbf = info->dbf;
 
 #if NFS_HACK
-	unlink(info->lockfn);
+	V_UNLINK(info->lockfn);
 #else
 	if (info->lockfn) {
 		lockfd = V_OPEN((info->lockfn,O_RDWR,0644));
Index: php4/ext/session/mod_files.c
diff -u php4/ext/session/mod_files.c:1.32 php4/ext/session/mod_files.c:1.33
--- php4/ext/session/mod_files.c:1.32	Thu May 18 17:34:34 2000
+++ php4/ext/session/mod_files.c	Tue May 23 16:36:27 2000
@@ -178,7 +178,7 @@
 				V_STAT(buf, &sbuf) == 0 &&
 				/* is it expired? */
 				(now - sbuf.st_atime) > maxlifetime) {
-			unlink(buf);
+			V_UNLINK(buf);
 			nrdels++;
 		}
 	}
@@ -276,7 +276,7 @@
 	if (!_ps_files_path_create(buf, sizeof(buf), data, key))
 		return FAILURE;
 	
-	unlink(buf);
+	V_UNLINK(buf);
 
 	return SUCCESS;
 }
Index: php4/ext/standard/file.c
diff -u php4/ext/standard/file.c:1.78 php4/ext/standard/file.c:1.79
--- php4/ext/standard/file.c:1.78	Thu May 18 17:34:35 2000
+++ php4/ext/standard/file.c	Tue May 23 16:36:27 2000
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: file.c,v 1.78 2000/05/18 15:34:35 zeev Exp $ */
+/* $Id: file.c,v 1.79 2000/05/23 14:36:27 andi Exp $ */
 
 /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
 
@@ -231,7 +231,7 @@
 
 static void _file_upload_dtor(char *file)
 {
-	unlink(file);
+	V_UNLINK(file);
 }
 
 
Index: php4/ext/standard/link.c
diff -u php4/ext/standard/link.c:1.21 php4/ext/standard/link.c:1.22
--- php4/ext/standard/link.c:1.21	Thu May 18 17:34:35 2000
+++ php4/ext/standard/link.c	Tue May 23 16:36:27 2000
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: link.c,v 1.21 2000/05/18 15:34:35 zeev Exp $ */
+/* $Id: link.c,v 1.22 2000/05/23 14:36:27 andi Exp $ */
 
 #include "php.h"
 #include "php_filestat.h"
@@ -181,7 +181,7 @@
 		RETURN_FALSE;
 	}
 
-	ret = unlink((*filename)->value.str.val);
+	ret = V_UNLINK((*filename)->value.str.val);
 	if (ret == -1) {
 		php_error(E_WARNING, "Unlink failed (%s)", strerror(errno));
 		RETURN_FALSE;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.