Fossil SCM
Report the effective file mode bits also.
Commit
7972e19f77094b66381a83dd14995ce1e60c4da6
Parent
834a5b6189e633a…
1 file changed
+18
-1
+18
-1
| --- src/file.c | ||
| +++ src/file.c | ||
| @@ -162,10 +162,26 @@ | ||
| 162 | 162 | ** Same as file_mtime(), but takes into account symlinks. |
| 163 | 163 | */ |
| 164 | 164 | i64 file_wd_mtime(const char *zFilename){ |
| 165 | 165 | return getStat(zFilename, 1) ? -1 : fileStat.st_mtime; |
| 166 | 166 | } |
| 167 | + | |
| 168 | +/* | |
| 169 | +** Return the mode bits for a file. Return -1 if the file does not | |
| 170 | +** exist. If zFilename is NULL return the size of the most recently | |
| 171 | +** stat-ed file. | |
| 172 | +*/ | |
| 173 | +int file_mode(const char *zFilename){ | |
| 174 | + return getStat(zFilename, 0) ? -1 : fileStat.st_mode; | |
| 175 | +} | |
| 176 | + | |
| 177 | +/* | |
| 178 | +** Same as file_mode(), but takes into account symlinks. | |
| 179 | +*/ | |
| 180 | +int file_wd_mode(const char *zFilename){ | |
| 181 | + return getStat(zFilename, 1) ? -1 : fileStat.st_mode; | |
| 182 | +} | |
| 167 | 183 | |
| 168 | 184 | /* |
| 169 | 185 | ** Return TRUE if the named file is an ordinary file or symlink |
| 170 | 186 | ** and symlinks are allowed. |
| 171 | 187 | ** Return false for directories, devices, fifos, etc. |
| @@ -976,12 +992,13 @@ | ||
| 976 | 992 | }else{ |
| 977 | 993 | sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_wd_size(zPath)); |
| 978 | 994 | fossil_print(" file_size = %s\n", zBuf); |
| 979 | 995 | sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_wd_mtime(zPath)); |
| 980 | 996 | fossil_print(" file_mtime = %s\n", zBuf); |
| 997 | + fossil_print(" file_mode = %d\n", file_wd_mode(zPath)); | |
| 981 | 998 | fossil_print(" file_isfile = %d\n", file_wd_isfile(zPath)); |
| 982 | - fossil_print(" file_isfile_or_link = %d\n",file_wd_isfile_or_link(zPath)); | |
| 999 | + fossil_print(" file_isfile_or_link = %d\n", file_wd_isfile_or_link(zPath)); | |
| 983 | 1000 | fossil_print(" file_islink = %d\n", file_wd_islink(zPath)); |
| 984 | 1001 | fossil_print(" file_isexe = %d\n", file_wd_isexe(zPath)); |
| 985 | 1002 | fossil_print(" file_isdir = %d\n", file_wd_isdir(zPath)); |
| 986 | 1003 | } |
| 987 | 1004 | } |
| 988 | 1005 |
| --- src/file.c | |
| +++ src/file.c | |
| @@ -162,10 +162,26 @@ | |
| 162 | ** Same as file_mtime(), but takes into account symlinks. |
| 163 | */ |
| 164 | i64 file_wd_mtime(const char *zFilename){ |
| 165 | return getStat(zFilename, 1) ? -1 : fileStat.st_mtime; |
| 166 | } |
| 167 | |
| 168 | /* |
| 169 | ** Return TRUE if the named file is an ordinary file or symlink |
| 170 | ** and symlinks are allowed. |
| 171 | ** Return false for directories, devices, fifos, etc. |
| @@ -976,12 +992,13 @@ | |
| 976 | }else{ |
| 977 | sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_wd_size(zPath)); |
| 978 | fossil_print(" file_size = %s\n", zBuf); |
| 979 | sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_wd_mtime(zPath)); |
| 980 | fossil_print(" file_mtime = %s\n", zBuf); |
| 981 | fossil_print(" file_isfile = %d\n", file_wd_isfile(zPath)); |
| 982 | fossil_print(" file_isfile_or_link = %d\n",file_wd_isfile_or_link(zPath)); |
| 983 | fossil_print(" file_islink = %d\n", file_wd_islink(zPath)); |
| 984 | fossil_print(" file_isexe = %d\n", file_wd_isexe(zPath)); |
| 985 | fossil_print(" file_isdir = %d\n", file_wd_isdir(zPath)); |
| 986 | } |
| 987 | } |
| 988 |
| --- src/file.c | |
| +++ src/file.c | |
| @@ -162,10 +162,26 @@ | |
| 162 | ** Same as file_mtime(), but takes into account symlinks. |
| 163 | */ |
| 164 | i64 file_wd_mtime(const char *zFilename){ |
| 165 | return getStat(zFilename, 1) ? -1 : fileStat.st_mtime; |
| 166 | } |
| 167 | |
| 168 | /* |
| 169 | ** Return the mode bits for a file. Return -1 if the file does not |
| 170 | ** exist. If zFilename is NULL return the size of the most recently |
| 171 | ** stat-ed file. |
| 172 | */ |
| 173 | int file_mode(const char *zFilename){ |
| 174 | return getStat(zFilename, 0) ? -1 : fileStat.st_mode; |
| 175 | } |
| 176 | |
| 177 | /* |
| 178 | ** Same as file_mode(), but takes into account symlinks. |
| 179 | */ |
| 180 | int file_wd_mode(const char *zFilename){ |
| 181 | return getStat(zFilename, 1) ? -1 : fileStat.st_mode; |
| 182 | } |
| 183 | |
| 184 | /* |
| 185 | ** Return TRUE if the named file is an ordinary file or symlink |
| 186 | ** and symlinks are allowed. |
| 187 | ** Return false for directories, devices, fifos, etc. |
| @@ -976,12 +992,13 @@ | |
| 992 | }else{ |
| 993 | sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_wd_size(zPath)); |
| 994 | fossil_print(" file_size = %s\n", zBuf); |
| 995 | sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_wd_mtime(zPath)); |
| 996 | fossil_print(" file_mtime = %s\n", zBuf); |
| 997 | fossil_print(" file_mode = %d\n", file_wd_mode(zPath)); |
| 998 | fossil_print(" file_isfile = %d\n", file_wd_isfile(zPath)); |
| 999 | fossil_print(" file_isfile_or_link = %d\n", file_wd_isfile_or_link(zPath)); |
| 1000 | fossil_print(" file_islink = %d\n", file_wd_islink(zPath)); |
| 1001 | fossil_print(" file_isexe = %d\n", file_wd_isexe(zPath)); |
| 1002 | fossil_print(" file_isdir = %d\n", file_wd_isdir(zPath)); |
| 1003 | } |
| 1004 | } |
| 1005 |