87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
-
+
|
** lstat() is called on Unix if isWd is TRUE and allow-symlinks setting is on.
**
*/
static int fossil_stat(const char *zFilename, struct fossilStat *buf, int isWd){
int rc;
void *zMbcs = fossil_utf8_to_path(zFilename, 0);
#if !defined(_WIN32)
if( isWd && g.allowSymlinks ){
if( isWd && db_allow_symlinks() ){
rc = lstat(zMbcs, buf);
}else{
rc = stat(zMbcs, buf);
}
#else
rc = win32_stat(zMbcs, buf, isWd);
#endif
|
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
|
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
|
-
+
|
** Create symlink to file on Unix, or plain-text file with
** symlink target if "allow-symlinks" is off or we're on Windows.
**
** Arguments: target file (symlink will point to it), link file
**/
void symlink_create(const char *zTargetFile, const char *zLinkFile){
#if !defined(_WIN32)
if( g.allowSymlinks ){
if( db_allow_symlinks() ){
int i, nName;
char *zName, zBuf[1000];
nName = strlen(zLinkFile);
if( nName>=sizeof(zBuf) ){
zName = mprintf("%s", zLinkFile);
}else{
|
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
|
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
|
-
+
|
** - PERM_REG for all other cases (regular file, directory, fifo, etc).
*/
int file_wd_perm(const char *zFilename){
#if !defined(_WIN32)
if( !getStat(zFilename, 1) ){
if( S_ISREG(fileStat.st_mode) && ((S_IXUSR)&fileStat.st_mode)!=0 )
return PERM_EXE;
else if( g.allowSymlinks && S_ISLNK(fileStat.st_mode) )
else if( db_allow_symlinks() && S_ISLNK(fileStat.st_mode) )
return PERM_LNK;
}
#endif
return PERM_REG;
}
/*
|