From: Nicholas Clark Date: Wed, 2 Nov 2005 20:13:24 +0000 (+0000) Subject: Move ftsuid ftsgid ftsvtx into Perl_pp_ftrowned. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=17ad201a5d2de952269cf4eeb85881a49a9c3867;p=p5sagit%2Fp5-mst-13.2.git Move ftsuid ftsgid ftsvtx into Perl_pp_ftrowned. p4raw-id: //depot/perl@25962 --- diff --git a/mathoms.c b/mathoms.c index bb7230a..e814a80 100644 --- a/mathoms.c +++ b/mathoms.c @@ -906,6 +906,21 @@ PP(pp_ftpipe) return pp_ftrowned(); } +PP(pp_ftsuid) +{ + return pp_ftrowned(); +} + +PP(pp_ftsgid) +{ + return pp_ftrowned(); +} + +PP(pp_ftsvtx) +{ + return pp_ftrowned(); +} + U8 * Perl_uvuni_to_utf8(pTHX_ U8 *d, UV uv) { diff --git a/opcode.h b/opcode.h index 46628c9..090621c 100644 --- a/opcode.h +++ b/opcode.h @@ -1023,9 +1023,9 @@ EXT Perl_ppaddr_t PL_ppaddr[] /* or perlvars.h */ MEMBER_TO_FPTR(Perl_pp_ftrowned), /* Perl_pp_ftdir */ MEMBER_TO_FPTR(Perl_pp_ftrowned), /* Perl_pp_ftpipe */ MEMBER_TO_FPTR(Perl_pp_ftlink), - MEMBER_TO_FPTR(Perl_pp_ftsuid), - MEMBER_TO_FPTR(Perl_pp_ftsgid), - MEMBER_TO_FPTR(Perl_pp_ftsvtx), + MEMBER_TO_FPTR(Perl_pp_ftrowned), /* Perl_pp_ftsuid */ + MEMBER_TO_FPTR(Perl_pp_ftrowned), /* Perl_pp_ftsgid */ + MEMBER_TO_FPTR(Perl_pp_ftrowned), /* Perl_pp_ftsvtx */ MEMBER_TO_FPTR(Perl_pp_fttty), MEMBER_TO_FPTR(Perl_pp_fttext), MEMBER_TO_FPTR(Perl_pp_fttext), /* Perl_pp_ftbinary */ diff --git a/opcode.pl b/opcode.pl index 23f6c35..7ac9922 100755 --- a/opcode.pl +++ b/opcode.pl @@ -54,7 +54,8 @@ my @raw_alias = ( Perl_pp_getpeername => ['getsockname'], Perl_pp_stat => ['lstat'], Perl_pp_ftrowned => [qw(fteowned ftzero ftsock ftchr ftblk - ftfile ftdir ftpipe)], + ftfile ftdir ftpipe ftsuid ftsgid + ftsvtx)], Perl_pp_fttext => ['ftbinary'], Perl_pp_gmtime => ['localtime'], Perl_pp_semget => [qw(shmget msgget)], diff --git a/pp_sys.c b/pp_sys.c index d005366..d932c2f 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -3085,6 +3085,22 @@ PP(pp_ftrowned) { I32 result; dSP; + + /* I believe that all these three are likely to be defined on most every + system these days. */ +#ifndef S_ISUID + if(PL_op->op_type == OP_FTSUID) + RETPUSHNO; +#endif +#ifndef S_ISGID + if(PL_op->op_type == OP_FTSGID) + RETPUSHNO; +#endif +#ifndef S_ISVTX + if(PL_op->op_type == OP_FTSVTX) + RETPUSHNO; +#endif + STACKED_FTEST_CHECK; result = my_stat(); SPAGAIN; @@ -3127,66 +3143,36 @@ PP(pp_ftrowned) if (S_ISFIFO(PL_statcache.st_mode)) RETPUSHYES; break; - } - RETPUSHNO; -} - -PP(pp_ftlink) -{ - I32 result = my_lstat(); - dSP; - if (result < 0) - RETPUSHUNDEF; - if (S_ISLNK(PL_statcache.st_mode)) - RETPUSHYES; - RETPUSHNO; -} - -PP(pp_ftsuid) -{ - dSP; #ifdef S_ISUID - I32 result; - STACKED_FTEST_CHECK; - result = my_stat(); - SPAGAIN; - if (result < 0) - RETPUSHUNDEF; - if (PL_statcache.st_mode & S_ISUID) - RETPUSHYES; + case OP_FTSUID: + if (PL_statcache.st_mode & S_ISUID) + RETPUSHYES; + break; #endif - RETPUSHNO; -} - -PP(pp_ftsgid) -{ - dSP; #ifdef S_ISGID - I32 result; - STACKED_FTEST_CHECK; - result = my_stat(); - SPAGAIN; - if (result < 0) - RETPUSHUNDEF; - if (PL_statcache.st_mode & S_ISGID) - RETPUSHYES; + case OP_FTSGID: + if (PL_statcache.st_mode & S_ISGID) + RETPUSHYES; + break; +#endif +#ifdef S_ISVTX + case OP_FTSVTX: + if (PL_statcache.st_mode & S_ISVTX) + RETPUSHYES; + break; #endif + } RETPUSHNO; } -PP(pp_ftsvtx) +PP(pp_ftlink) { + I32 result = my_lstat(); dSP; -#ifdef S_ISVTX - I32 result; - STACKED_FTEST_CHECK; - result = my_stat(); - SPAGAIN; if (result < 0) RETPUSHUNDEF; - if (PL_statcache.st_mode & S_ISVTX) + if (S_ISLNK(PL_statcache.st_mode)) RETPUSHYES; -#endif RETPUSHNO; }