diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 1999-08-10 14:11:15 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 1999-08-10 14:11:15 +0000 |
commit | 7f4774ae47f6628888c2da9409229189fba57844 (patch) | |
tree | c1e262736046e81b3df014ae36b194c098cf7778 | |
parent | 884baa66f4892b29ff648df5ff336287a8c8c7c0 (diff) | |
download | perl-7f4774ae47f6628888c2da9409229189fba57844.tar.gz |
Use Mode_t.
p4raw-id: //depot/cfgperl@3949
-rw-r--r-- | doio.c | 17 | ||||
-rwxr-xr-x | embed.pl | 4 | ||||
-rwxr-xr-x | perlapi.c | 6 | ||||
-rw-r--r-- | pp_sys.c | 4 | ||||
-rw-r--r-- | proto.h | 4 |
5 files changed, 18 insertions, 17 deletions
@@ -1487,9 +1487,10 @@ nothing in the core. /* Do the permissions allow some operation? Assumes statcache already set. */ #ifndef VMS /* VMS' cando is in vms.c */ -I32 -Perl_cando(pTHX_ I32 bit, Uid_t effective, register struct stat *statbufp) -/* Note: we use `effective' both for uids and gids. */ +bool +Perl_cando(pTHX_ Mode_t mode, Uid_t effective, register Stat_t *statbufp) +/* Note: we use `effective' both for uids and gids. + * Here we are betting on Uid_t being equal or wider than Gid_t. */ { #ifdef DOSISH /* [Comments and code from Len Reed] @@ -1513,11 +1514,11 @@ Perl_cando(pTHX_ I32 bit, Uid_t effective, register struct stat *statbufp) /* Atari stat() does pretty much the same thing. we set x_bit_set_in_stat * too so it will actually look into the files for magic numbers */ - return (bit & statbufp->st_mode) ? TRUE : FALSE; + return (mode & statbufp->st_mode) ? TRUE : FALSE; #else /* ! DOSISH */ if ((effective ? PL_euid : PL_uid) == 0) { /* root is special */ - if (bit == S_IXUSR) { + if (mode == S_IXUSR) { if (statbufp->st_mode & 0111 || S_ISDIR(statbufp->st_mode)) return TRUE; } @@ -1526,14 +1527,14 @@ Perl_cando(pTHX_ I32 bit, Uid_t effective, register struct stat *statbufp) return FALSE; } if (statbufp->st_uid == (effective ? PL_euid : PL_uid) ) { - if (statbufp->st_mode & bit) + if (statbufp->st_mode & mode) return TRUE; /* ok as "user" */ } else if (ingroup(statbufp->st_gid,effective)) { - if (statbufp->st_mode & bit >> 3) + if (statbufp->st_mode & mode >> 3) return TRUE; /* ok as "group" */ } - else if (statbufp->st_mode & bit >> 6) + else if (statbufp->st_mode & mode >> 6) return TRUE; /* ok as "other" */ return FALSE; #endif /* ! DOSISH */ @@ -1051,7 +1051,7 @@ p |I32 |block_gimme p |int |block_start |int full p |void |boot_core_UNIVERSAL p |void |call_list |I32 oldscope|AV* av_list -p |I32 |cando |I32 bit|Uid_t effective|Stat_t* statbufp +p |bool |cando |Mode_t mode|Uid_t effective|Stat_t* statbufp p |U32 |cast_ulong |NV f p |I32 |cast_i32 |NV f p |IV |cast_iv |NV f @@ -1909,7 +1909,7 @@ s |SV* |method_common |SV* meth|U32* hashp #if defined(PERL_IN_PP_SYS_C) || defined(PERL_DECL_PROT) s |OP* |doform |CV *cv|GV *gv|OP *retop -s |int |emulate_eaccess|const char* path|int mode +s |int |emulate_eaccess|const char* path|Mode_t mode # if !defined(HAS_MKDIR) || !defined(HAS_RMDIR) s |int |dooneliner |char *cmd|char *filename # endif @@ -253,10 +253,10 @@ Perl_call_list(pTHXo_ I32 oldscope, AV* av_list) } #undef Perl_cando -I32 -Perl_cando(pTHXo_ I32 bit, Uid_t effective, Stat_t* statbufp) +bool +Perl_cando(pTHXo_ Mode_t mode, Uid_t effective, Stat_t* statbufp) { - return ((CPerlObj*)pPerl)->Perl_cando(bit, effective, statbufp); + return ((CPerlObj*)pPerl)->Perl_cando(mode, effective, statbufp); } #undef Perl_cast_ulong @@ -230,7 +230,7 @@ static char zero_but_true[ZBTLEN + 1] = "0 but true"; || defined(HAS_SETREGID) || defined(HAS_SETRESGID)) /* The Hard Way. */ STATIC int -S_emulate_eaccess(pTHX_ const char* path, int mode) +S_emulate_eaccess(pTHX_ const char* path, Mode_t mode) { Uid_t ruid = getuid(); Uid_t euid = geteuid(); @@ -295,7 +295,7 @@ S_emulate_eaccess(pTHX_ const char* path, int mode) #if !defined(PERL_EFF_ACCESS_R_OK) STATIC int -S_emulate_eaccess(pTHX_ const char* path, int mode) +S_emulate_eaccess(pTHX_ const char* path, Mode_t mode) { Perl_croak(aTHX_ "switching effective uid is not implemented"); /*NOTREACHED*/ @@ -37,7 +37,7 @@ VIRTUAL I32 Perl_block_gimme(pTHX); VIRTUAL int Perl_block_start(pTHX_ int full); VIRTUAL void Perl_boot_core_UNIVERSAL(pTHX); VIRTUAL void Perl_call_list(pTHX_ I32 oldscope, AV* av_list); -VIRTUAL I32 Perl_cando(pTHX_ I32 bit, Uid_t effective, Stat_t* statbufp); +VIRTUAL bool Perl_cando(pTHX_ Mode_t mode, Uid_t effective, Stat_t* statbufp); VIRTUAL U32 Perl_cast_ulong(pTHX_ NV f); VIRTUAL I32 Perl_cast_i32(pTHX_ NV f); VIRTUAL IV Perl_cast_iv(pTHX_ NV f); @@ -845,7 +845,7 @@ STATIC SV* S_method_common(pTHX_ SV* meth, U32* hashp); #endif #if defined(PERL_IN_PP_SYS_C) || defined(PERL_DECL_PROT) STATIC OP* S_doform(pTHX_ CV *cv, GV *gv, OP *retop); -STATIC int S_emulate_eaccess(pTHX_ const char* path, int mode); +STATIC int S_emulate_eaccess(pTHX_ const char* path, Mode_t mode); # if !defined(HAS_MKDIR) || !defined(HAS_RMDIR) STATIC int S_dooneliner(pTHX_ char *cmd, char *filename); # endif |