291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
|
**
** If eFType is ExtFile then symbolic links are followed and so this
** routine can only return PERM_EXE and PERM_REG.
**
** On windows, this routine returns only PERM_REG.
*/
int file_perm(const char *zFilename, int eFType){
#if !defined(_WIN32)
if( !getStat(zFilename, RepoFILE) ){
if( S_ISREG(fx.fileStat.st_mode) && ((S_IXUSR)&fx.fileStat.st_mode)!=0 )
return PERM_EXE;
else if( db_allow_symlinks() && S_ISLNK(fx.fileStat.st_mode) )
return PERM_LNK;
}
#endif
|
|
>
>
>
>
>
>
>
>
>
>
>
|
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
|
**
** If eFType is ExtFile then symbolic links are followed and so this
** routine can only return PERM_EXE and PERM_REG.
**
** On windows, this routine returns only PERM_REG.
*/
int file_perm(const char *zFilename, int eFType){
#if defined(_WIN32)
static const char *azExts[] = { ".com", ".exe", NULL };
const char *zExt = strrchr(zFilename, '.');
if( zExt ){
int i;
for( i=0; azExts[i]; i++ ){
if( sqlite3_stricmp(zExt, azExts[i])==0 ){
return PERM_EXE;
}
}
}
#else
if( !getStat(zFilename, RepoFILE) ){
if( S_ISREG(fx.fileStat.st_mode) && ((S_IXUSR)&fx.fileStat.st_mode)!=0 )
return PERM_EXE;
else if( db_allow_symlinks() && S_ISLNK(fx.fileStat.st_mode) )
return PERM_LNK;
}
#endif
|