77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
-
-
+
+
-
-
-
+
+
+
|
/*
** Fill stat buf with information received from stat() or lstat().
** 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){
#if !defined(_WIN32)
int rc;
char *zMbcs = fossil_utf8_to_filename(zFilename);
void *zMbcs = fossil_utf8_to_filename(zFilename);
#if !defined(_WIN32)
if( isWd && g.allowSymlinks ){
rc = lstat(zMbcs, buf);
}else{
rc = stat(zMbcs, buf);
}
fossil_filename_free(zMbcs);
return rc;
#else
return win32_stat(zFilename, buf, isWd);
rc = win32_stat(zMbcs, buf, isWd);
#endif
fossil_filename_free(zMbcs);
return rc;
}
/*
** Fill in the fileStat variable for the file named zFilename.
** If zFilename==0, then use the previous value of fileStat if
** there is a previous value.
**
|
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
|
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
|
+
+
-
+
-
-
+
+
-
+
+
-
+
-
+
-
|
}
/*
** Wrapper around the access() system call.
*/
int file_access(const char *zFilename, int flags){
int rc;
void *zMbcs = fossil_utf8_to_filename(zFilename);
#ifdef _WIN32
return win32_access(zFilename, flags);
rc = win32_access(zMbcs, flags);
#else
char *zMbcs = fossil_utf8_to_filename(zFilename);
int rc = access(zMbcs, flags);
rc = access(zMbcs, flags);
#endif
fossil_filename_free(zMbcs);
return rc;
#endif
}
/*
** Wrapper around the chdir() system call.
** If bChroot=1, do a chroot to this dir as well
** (UNIX only)
*/
int file_chdir(const char *zChDir, int bChroot){
int rc;
void *zPath = fossil_utf8_to_filename(zChDir);
#ifdef _WIN32
return win32_chdir(zChDir, bChroot);
rc = win32_chdir(zPath, bChroot);
#else
char *zPath = fossil_utf8_to_filename(zChDir);
int rc = chdir(zPath);
if( !rc && bChroot ){
rc = chroot(zPath);
if( !rc ) rc = chdir("/");
}
#endif
fossil_filename_free(zPath);
return rc;
#endif
}
/*
** Find an unused filename similar to zBase with zSuffix appended.
**
** Make the name relative to the working directory if relFlag is true.
**
|