CVS update: php3/functions

From: Date: Sun, 06 Sep 1998 20:46:10 +0000
Subject: CVS update: php3/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-840@lists.php.net to get a copy of this message
Date: Sunday September 6, 1998 @ 16:46 Author: jaakko Update of /repository/php3/functions In directory asf:/u2/tmp/cvs-serv14929/functions Modified Files: filestat.c Log Message: Remove calls to lstat(2) is HAVE_SYMLINK is 0. I that case php function lstat is equal to stat. Index: php3/functions/filestat.c diff -c php3/functions/filestat.c:1.76 php3/functions/filestat.c:1.77 *** php3/functions/filestat.c:1.76 Sun Sep 6 02:50:22 1998 --- php3/functions/filestat.c Sun Sep 6 16:46:09 1998 *************** *** 27,33 **** +----------------------------------------------------------------------+ */ ! /* $Id: filestat.c,v 1.76 1998/09/06 06:50:22 jaakko Exp $ */ #ifdef THREAD_SAFE #include "tls.h" #endif --- 27,33 ---- +----------------------------------------------------------------------+ */ ! /* $Id: filestat.c,v 1.77 1998/09/06 20:46:09 jaakko Exp $ */ #ifdef THREAD_SAFE #include "tls.h" #endif *************** *** 80,87 **** # else static int CurrentStatLength=0; # endif ! static struct stat sb, lsb; #endif #ifndef S_ISDIR #define S_ISDIR(mode) (((mode)&S_IFMT) == S_IFDIR) --- 80,90 ---- # else static int CurrentStatLength=0; # endif ! static struct stat sb; ! #if HAVE_SYMLINK ! static struct stat lsb; #endif + #endif #ifndef S_ISDIR #define S_ISDIR(mode) (((mode)&S_IFMT) == S_IFDIR) *************** *** 324,330 **** --- 327,335 ---- } else { strcpy(GLOBAL(CurrentStatFile),filename); } + #if HAVE_SYMLINK GLOBAL(lsb).st_mode = 0; /* mark lstat buf invalid */ + #endif if (stat(GLOBAL(CurrentStatFile),&GLOBAL(sb))==-1) { if (type != 15 || errno != ENOENT) { /* fileexists() test must print no error */ php3_error(E_NOTICE,"stat failed for %s (errno=%d - %s)",GLOBAL(CurrentStatFile),errno,strerror(errno)); *************** *** 335,340 **** --- 340,346 ---- } } + #if HAVE_SYMLINK if (8 == type /* filetype */ || 14 == type /* is link */ || 16 == type) { /* lstat */ *************** *** 348,353 **** --- 354,360 ---- } } } + #endif switch(type) { case 0: /* fileperms */ *************** *** 367,375 **** --- 374,384 ---- case 7: /* filectime */ RETURN_LONG((long)GLOBAL(sb).st_ctime); case 8: /* filetype */ + #if HAVE_SYMLINK if (S_ISLNK(GLOBAL(lsb).st_mode)) { RETURN_STRING("link",1); } + #endif switch(GLOBAL(sb).st_mode&S_IFMT) { case S_IFIFO: RETURN_STRING("fifo",1); case S_IFCHR: RETURN_STRING("char",1); *************** *** 390,400 **** --- 399,415 ---- case 13: /*is dir*/ RETURN_LONG(S_ISDIR(GLOBAL(sb).st_mode)); case 14: /*is link*/ + #if HAVE_SYMLINK RETURN_LONG(S_ISLNK(GLOBAL(lsb).st_mode)); + #else + RETURN_FALSE; + #endif case 15: /*file exists*/ RETURN_TRUE; /* the false case was done earlier */ case 16: /* lstat */ + #if HAVE_SYMLINK stat_sb = &GLOBAL(lsb); + #endif /* FALLTHROUGH */ case 17: /* stat */ if (array_init(return_value) == FAILURE) { -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#840) next »