197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
|
#else
return ((S_IXUSR|S_IXGRP|S_IXOTH)&fileStat.st_mode)!=0;
#endif
}
/*
** Return file "permissions":
** 0: normal
** 1: exec
** 2: symlink
*/
int file_perm(const char *zFilename){
//TODO(dchest): optimize by calling stat once.
if( file_isexe(zFilename) )
return 1;
if( file_islink(zFilename) )
return 2;
return 0;
}
/*
** Return 1 if zFilename is a directory. Return 0 if zFilename
** does not exist. Return 2 if zFilename exists but is something
** other than a directory.
*/
|
|
<
<
<
|
|
|
|
|
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
|
#else
return ((S_IXUSR|S_IXGRP|S_IXOTH)&fileStat.st_mode)!=0;
#endif
}
/*
** Return file "permissions" (normal, executable, or symlink).
*/
int file_perm(const char *zFilename){
/*TODO(dchest): optimize by calling stat once.*/
if( file_isexe(zFilename) )
return PERM_EXE;
if( file_islink(zFilename) )
return PERM_LNK;
return PERM_REG;
}
/*
** Return 1 if zFilename is a directory. Return 0 if zFilename
** does not exist. Return 2 if zFilename exists but is something
** other than a directory.
*/
|