From 7e44e0993947f71d5b12e6d20a9829a3fa7dfe53 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Thu, 8 Nov 2007 16:05:09 +0000 Subject: [PATCH] Fixed bug with -chmod go=r --- libisoburn/trunk/test/xorriso.c | 21 +++++++++++++++------ libisoburn/trunk/test/xorriso_timestamp.h | 2 +- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/libisoburn/trunk/test/xorriso.c b/libisoburn/trunk/test/xorriso.c index 144f890e..de5f4583 100644 --- a/libisoburn/trunk/test/xorriso.c +++ b/libisoburn/trunk/test/xorriso.c @@ -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,15 +4039,23 @@ int Xorriso_option_chmodi(struct XorrisO *xorriso, char *mode, if(who_val&2) mode_val|= S_ISGID; } else if(*vpt=='t') { - mode_val|= S_ISVTX; + if(who_val&1) + mode_val|= S_ISVTX; } else goto unrecognizable; } 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; diff --git a/libisoburn/trunk/test/xorriso_timestamp.h b/libisoburn/trunk/test/xorriso_timestamp.h index 8ac3be77..12f72b2b 100644 --- a/libisoburn/trunk/test/xorriso_timestamp.h +++ b/libisoburn/trunk/test/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2007.11.08.145016" +#define Xorriso_timestamP "2007.11.08.160302"