dmitry Fri Nov 10 09:56:37 2006 UTC
Removed files:
/php-src/win32 pwd.c pwd.h
Modified files:
/php-src/win32 glob.c globals.c php5dll.dsp php5dllts.dsp
php_win32_globals.h
/php-src/win32/build config.w32 config.w32.h.in
/php-src/main config.w32.h fopen_wrappers.c php.h
/php-src/ext/standard basic_functions.c
Log:
Simplify the code base as this getpwd() was used only once
http://cvs.php.net/viewvc.cgi/php-src/win32/glob.c?r1=1.6&r2=1.7&diff_format=u
Index: php-src/win32/glob.c
diff -u php-src/win32/glob.c:1.6 php-src/win32/glob.c:1.7
--- php-src/win32/glob.c:1.6 Sat Sep 20 03:22:36 2003
+++ php-src/win32/glob.c Fri Nov 10 09:56:37 2006
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*/
-/* $Id: glob.c,v 1.6 2003/09/20 03:22:36 sniper Exp $ */
+/* $Id: glob.c,v 1.7 2006/11/10 09:56:37 dmitry Exp $ */
/*
* glob(3) -- a superset of the one defined in POSIX 1003.2.
@@ -81,8 +81,6 @@
#include <dirent.h>
#include <pwd.h>
#include <unistd.h>
-#else
-#include "win32/pwd.h"
#endif
#include <errno.h>
#include "glob.h"
@@ -359,7 +357,9 @@
size_t patbuf_len;
glob_t *pglob;
{
+#ifndef PHP_WIN32
struct passwd *pwd;
+#endif
char *h;
const Char *p;
Char *b, *eb;
@@ -399,10 +399,14 @@
/*
* Expand a ~user
*/
+#ifndef PHP_WIN32
if ((pwd = getpwnam((char*) patbuf)) == NULL)
return pattern;
else
h = pwd->pw_dir;
+#else
+ return pattern;
+#endif
}
/* Copy the home directory */
http://cvs.php.net/viewvc.cgi/php-src/win32/globals.c?r1=1.6&r2=1.7&diff_format=u
Index: php-src/win32/globals.c
diff -u php-src/win32/globals.c:1.6 php-src/win32/globals.c:1.7
--- php-src/win32/globals.c:1.6 Sun Jan 1 13:09:59 2006
+++ php-src/win32/globals.c Fri Nov 10 09:56:37 2006
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: globals.c,v 1.6 2006/01/01 13:09:59 sniper Exp $ */
+/* $Id: globals.c,v 1.7 2006/11/10 09:56:37 dmitry Exp $ */
#include "php.h"
#include "php_win32_globals.h"
@@ -43,8 +43,6 @@
#endif
;
- STR_FREE(wg->login_name);
-
memset(wg, 0, sizeof(*wg));
return SUCCESS;
}
http://cvs.php.net/viewvc.cgi/php-src/win32/php5dll.dsp?r1=1.5&r2=1.6&diff_format=u
Index: php-src/win32/php5dll.dsp
diff -u php-src/win32/php5dll.dsp:1.5 php-src/win32/php5dll.dsp:1.6
--- php-src/win32/php5dll.dsp:1.5 Wed Mar 8 14:41:45 2006
+++ php-src/win32/php5dll.dsp Fri Nov 10 09:56:37 2006
@@ -1540,10 +1540,6 @@
# End Source File
# Begin Source File
-SOURCE=..\win32\pwd.c
-# End Source File
-# Begin Source File
-
SOURCE=..\win32\readdir.c
# End Source File
# Begin Source File
@@ -1616,10 +1612,6 @@
# End Source File
# Begin Source File
-SOURCE=..\win32\pwd.h
-# End Source File
-# Begin Source File
-
SOURCE=..\win32\readdir.h
# End Source File
# Begin Source File
http://cvs.php.net/viewvc.cgi/php-src/win32/php5dllts.dsp?r1=1.8&r2=1.9&diff_format=u
Index: php-src/win32/php5dllts.dsp
diff -u php-src/win32/php5dllts.dsp:1.8 php-src/win32/php5dllts.dsp:1.9
--- php-src/win32/php5dllts.dsp:1.8 Wed Mar 8 14:41:45 2006
+++ php-src/win32/php5dllts.dsp Fri Nov 10 09:56:37 2006
@@ -2032,10 +2032,6 @@
# End Source File
# Begin Source File
-SOURCE=..\win32\pwd.c
-# End Source File
-# Begin Source File
-
SOURCE=..\win32\readdir.c
# End Source File
# Begin Source File
@@ -2096,10 +2092,6 @@
# End Source File
# Begin Source File
-SOURCE=..\win32\pwd.h
-# End Source File
-# Begin Source File
-
SOURCE=..\win32\readdir.h
# End Source File
# Begin Source File
http://cvs.php.net/viewvc.cgi/php-src/win32/php_win32_globals.h?r1=1.5&r2=1.6&diff_format=u
Index: php-src/win32/php_win32_globals.h
diff -u php-src/win32/php_win32_globals.h:1.5
php-src/win32/php_win32_globals.h:1.6
--- php-src/win32/php_win32_globals.h:1.5 Sun Jan 1 13:09:59 2006
+++ php-src/win32/php_win32_globals.h Fri Nov 10 09:56:37 2006
@@ -16,15 +16,13 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_win32_globals.h,v 1.5 2006/01/01 13:09:59 sniper Exp $ */
+/* $Id: php_win32_globals.h,v 1.6 2006/11/10 09:56:37 dmitry Exp $ */
#ifndef PHP_WIN32_GLOBALS_H
#define PHP_WIN32_GLOBALS_H
/* misc globals for thread-safety under win32 */
-#include "pwd.h"
-
typedef struct _php_win32_core_globals php_win32_core_globals;
#ifdef ZTS
@@ -40,12 +38,6 @@
char *log_header;
HANDLE log_source;
- /* getpwuid */
- struct passwd pwd;
-
- /* getlogin */
- char *login_name;
-
/* time */
struct timeval starttime;
__int64 lasttime, freq;
http://cvs.php.net/viewvc.cgi/php-src/win32/build/config.w32?r1=1.56&r2=1.57&diff_format=u
Index: php-src/win32/build/config.w32
diff -u php-src/win32/build/config.w32:1.56 php-src/win32/build/config.w32:1.57
--- php-src/win32/build/config.w32:1.56 Tue Jul 18 09:08:06 2006
+++ php-src/win32/build/config.w32 Fri Nov 10 09:56:37 2006
@@ -1,5 +1,5 @@
// vim:ft=javascript
-// $Id: config.w32,v 1.56 2006/07/18 09:08:06 dmitry Exp $
+// $Id: config.w32,v 1.57 2006/11/10 09:56:37 dmitry Exp $
// "Master" config file; think of it as a configure.in
// equivalent.
@@ -281,7 +281,7 @@
ADD_SOURCES("main/streams", "streams.c cast.c memory.c filter.c
plain_wrapper.c \
userspace.c transports.c xp_socket.c mmap.c unicode_filter.c");
-ADD_SOURCES("win32", "crypt_win32.c flock.c glob.c md5crypt.c pwd.c readdir.c \
+ADD_SOURCES("win32", "crypt_win32.c flock.c glob.c md5crypt.c readdir.c \
registry.c select.c sendmail.c time.c wfile.c winutil.c wsyslog.c
globals.c");
ADD_SOURCES("regex", "regcomp.c regerror.c regexec.c regfree.c");
http://cvs.php.net/viewvc.cgi/php-src/win32/build/config.w32.h.in?r1=1.11&r2=1.12&diff_format=u
Index: php-src/win32/build/config.w32.h.in
diff -u php-src/win32/build/config.w32.h.in:1.11
php-src/win32/build/config.w32.h.in:1.12
--- php-src/win32/build/config.w32.h.in:1.11 Mon Apr 10 15:09:15 2006
+++ php-src/win32/build/config.w32.h.in Fri Nov 10 09:56:37 2006
@@ -1,6 +1,6 @@
/*
Build Configuration Template for Win32.
- $Id: config.w32.h.in,v 1.11 2006/04/10 15:09:15 sniper Exp $
+ $Id: config.w32.h.in,v 1.12 2006/11/10 09:56:37 dmitry Exp $
*/
/* Default PHP / PEAR directories */
@@ -99,7 +99,7 @@
#define HAVE_ASSERT_H 1
#define HAVE_FCNTL_H 1
#define HAVE_GRP_H 0
-#define HAVE_PWD_H 1
+#undef HAVE_PWD_H
#define HAVE_STRING_H 1
#undef HAVE_SYS_FILE_H
#undef HAVE_SYS_SOCKET_H
http://cvs.php.net/viewvc.cgi/php-src/main/config.w32.h?r1=1.87&r2=1.88&diff_format=u
Index: php-src/main/config.w32.h
diff -u php-src/main/config.w32.h:1.87 php-src/main/config.w32.h:1.88
--- php-src/main/config.w32.h:1.87 Wed Mar 8 14:41:45 2006
+++ php-src/main/config.w32.h Fri Nov 10 09:56:37 2006
@@ -2,7 +2,7 @@
Build Configuration for Win32.
This has only been tested with MS VisualC++ 6 (and later).
- $Id: config.w32.h,v 1.87 2006/03/08 14:41:45 iliaa Exp $
+ $Id: config.w32.h,v 1.88 2006/11/10 09:56:37 dmitry Exp $
*/
/* Default PHP / PEAR directories */
@@ -156,7 +156,7 @@
#define HAVE_ASSERT_H 1
#define HAVE_FCNTL_H 1
#define HAVE_GRP_H 0
-#define HAVE_PWD_H 1
+#undef HAVE_PWD_H
#define HAVE_STRING_H 1
#undef HAVE_SYS_FILE_H
#undef HAVE_SYS_SOCKET_H
http://cvs.php.net/viewvc.cgi/php-src/main/fopen_wrappers.c?r1=1.184&r2=1.185&diff_format=u
Index: php-src/main/fopen_wrappers.c
diff -u php-src/main/fopen_wrappers.c:1.184 php-src/main/fopen_wrappers.c:1.185
--- php-src/main/fopen_wrappers.c:1.184 Tue Oct 17 21:54:16 2006
+++ php-src/main/fopen_wrappers.c Fri Nov 10 09:56:37 2006
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: fopen_wrappers.c,v 1.184 2006/10/17 21:54:16 pollita Exp $ */
+/* $Id: fopen_wrappers.c,v 1.185 2006/11/10 09:56:37 dmitry Exp $ */
/* {{{ includes
*/
@@ -45,12 +45,8 @@
#include "php_network.h"
#if HAVE_PWD_H
-#ifdef PHP_WIN32
-#include "win32/pwd.h"
-#else
#include <pwd.h>
#endif
-#endif
#include <sys/types.h>
#if HAVE_SYS_SOCKET_H
http://cvs.php.net/viewvc.cgi/php-src/main/php.h?r1=1.233&r2=1.234&diff_format=u
Index: php-src/main/php.h
diff -u php-src/main/php.h:1.233 php-src/main/php.h:1.234
--- php-src/main/php.h:1.233 Mon Sep 4 08:18:35 2006
+++ php-src/main/php.h Fri Nov 10 09:56:37 2006
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php.h,v 1.233 2006/09/04 08:18:35 dmitry Exp $ */
+/* $Id: php.h,v 1.234 2006/11/10 09:56:37 dmitry Exp $ */
#ifndef PHP_H
#define PHP_H
@@ -199,7 +199,6 @@
#if HAVE_PWD_H
# ifdef PHP_WIN32
-#include "win32/pwd.h"
#include "win32/param.h"
# else
#include <pwd.h>
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/basic_functions.c?r1=1.820&r2=1.821&diff_format=u
Index: php-src/ext/standard/basic_functions.c
diff -u php-src/ext/standard/basic_functions.c:1.820
php-src/ext/standard/basic_functions.c:1.821
--- php-src/ext/standard/basic_functions.c:1.820 Wed Oct 25 20:30:51 2006
+++ php-src/ext/standard/basic_functions.c Fri Nov 10 09:56:37 2006
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: basic_functions.c,v 1.820 2006/10/25 20:30:51 andrei Exp $ */
+/* $Id: basic_functions.c,v 1.821 2006/11/10 09:56:37 dmitry Exp $ */
#include "php.h"
#include "php_streams.h"
@@ -4957,7 +4957,6 @@
PHPAPI char *php_get_current_user()
{
- struct passwd *pwd;
struct stat *pstat;
TSRMLS_FETCH();
@@ -4973,15 +4972,29 @@
if (!pstat) {
return "";
- }
+ } else {
+#ifdef PHP_WIN32
+ char name[256];
+ DWORD len = sizeof(name)-1;
- if ((pwd=getpwuid(pstat->st_uid))==NULL) {
- return "";
+ if (!GetUserName(name, &len)) {
+ return "";
+ }
+ name[len] = '\0';
+ SG(request_info).current_user_length = len;
+ SG(request_info).current_user = estrndup(name, len);
+ return SG(request_info).current_user;
+#else
+ struct passwd *pwd;
+
+ if ((pwd=getpwuid(pstat->st_uid))==NULL) {
+ return "";
+ }
+ SG(request_info).current_user_length = strlen(pwd->pw_name);
+ SG(request_info).current_user = estrndup(pwd->pw_name,
SG(request_info).current_user_length);
+ return SG(request_info).current_user;
+#endif
}
- SG(request_info).current_user_length = strlen(pwd->pw_name);
- SG(request_info).current_user = estrndup(pwd->pw_name,
SG(request_info).current_user_length);
-
- return SG(request_info).current_user;
}
/* {{{ proto array error_get_last() U
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php