Fixed bug with -chmod go=r

This commit is contained in:
Thomas Schmitt 2007-11-08 16:05:09 +00:00
parent af7b92b699
commit 9dc3dbb1ab
2 changed files with 16 additions and 7 deletions

View File

@ -1521,7 +1521,7 @@ time_t Decode_timestring(char *code, time_t *date, int flag)
seconds= 0;
sscanf(code+1,"%lf",&value);
} else {
seconds= time(0);
seconds= time(NULL);
sscanf(code,"%lf",&value);
}
scale_chr= code[strlen(code)-1];
@ -3979,7 +3979,7 @@ int Xorriso_option_chmodi(struct XorrisO *xorriso, char *mode,
{
int i, end_idx, ret, who_val= 0, was_failure= 0;
unsigned int num;
mode_t mode_and= ~0, mode_or= 0, mode_val;
mode_t mode_and= ~0, mode_or= 0, mode_val, mask;
char sfe[4*SfileadrL], *mpt, *opt, *vpt;
end_idx= Xorriso_end_idx(xorriso, argc, argv, *idx, 0);
@ -3988,7 +3988,8 @@ int Xorriso_option_chmodi(struct XorrisO *xorriso, char *mode,
mode_and= 0;
sscanf(mode,"%o",&num);
mode_or= num;
} else if(strchr(mode,'+')!=NULL || strchr(mode,'-')!=NULL) {
} else if(strchr(mode,'+')!=NULL || strchr(mode,'-')!=NULL
|| strchr(mode,'=')!=NULL) {
/* [ugoa][+-][rwxst] */;
for(mpt= mode; mpt!=NULL; mpt= strchr(mpt, ',')) {
if(*mpt==',')
@ -4038,6 +4039,7 @@ int Xorriso_option_chmodi(struct XorrisO *xorriso, char *mode,
if(who_val&2)
mode_val|= S_ISGID;
} else if(*vpt=='t') {
if(who_val&1)
mode_val|= S_ISVTX;
} else
goto unrecognizable;
@ -4045,8 +4047,15 @@ int Xorriso_option_chmodi(struct XorrisO *xorriso, char *mode,
if(*opt=='+') {
mode_or|= mode_val;
} else if(*opt=='=') {
mode_and= 0;
mode_or= mode_val;
mask= 0;
if(who_val&1)
mask|= S_IRWXO|S_ISVTX;
if(who_val&2)
mask|= S_IRWXG|S_ISGID;
if(who_val&4)
mask|= S_IRWXU|S_ISUID;
mode_and&= ~(mask);
mode_or= (mode_or & ~mask) | mode_val;
} else if(*opt=='-') {
mode_or&= ~mode_val;
mode_and&= ~mode_val;

View File

@ -1 +1 @@
#define Xorriso_timestamP "2007.11.08.145016"
#define Xorriso_timestamP "2007.11.08.160302"