Fossil SCM
Add a wrapper around all calls to access() that translates UTF8 to MBCS.
Commit
850d3df44e03f4c5f1257a6a6bc4d5532b5b6174
Parent
b7df0b9ce6d707f…
8 files changed
+1
-1
+2
-2
+2
-2
+6
-6
+2
-2
+10
+1
-1
+1
-1
+1
-1
| --- src/add.c | ||
| +++ src/add.c | ||
| @@ -215,11 +215,11 @@ | ||
| 215 | 215 | isDir = file_isdir(zName); |
| 216 | 216 | if( isDir==1 ){ |
| 217 | 217 | vfile_scan(&fullName, nRoot-1, includeDotFiles, pIgnore); |
| 218 | 218 | }else if( isDir==0 ){ |
| 219 | 219 | fossil_fatal("not found: %s", zName); |
| 220 | - }else if( access(zName, R_OK) ){ | |
| 220 | + }else if( file_access(zName, R_OK) ){ | |
| 221 | 221 | fossil_fatal("cannot open %s", zName); |
| 222 | 222 | }else{ |
| 223 | 223 | char *zTreeName = &zName[nRoot]; |
| 224 | 224 | db_multi_exec( |
| 225 | 225 | "INSERT OR IGNORE INTO sfile(x)" |
| 226 | 226 |
| --- src/add.c | |
| +++ src/add.c | |
| @@ -215,11 +215,11 @@ | |
| 215 | isDir = file_isdir(zName); |
| 216 | if( isDir==1 ){ |
| 217 | vfile_scan(&fullName, nRoot-1, includeDotFiles, pIgnore); |
| 218 | }else if( isDir==0 ){ |
| 219 | fossil_fatal("not found: %s", zName); |
| 220 | }else if( access(zName, R_OK) ){ |
| 221 | fossil_fatal("cannot open %s", zName); |
| 222 | }else{ |
| 223 | char *zTreeName = &zName[nRoot]; |
| 224 | db_multi_exec( |
| 225 | "INSERT OR IGNORE INTO sfile(x)" |
| 226 |
| --- src/add.c | |
| +++ src/add.c | |
| @@ -215,11 +215,11 @@ | |
| 215 | isDir = file_isdir(zName); |
| 216 | if( isDir==1 ){ |
| 217 | vfile_scan(&fullName, nRoot-1, includeDotFiles, pIgnore); |
| 218 | }else if( isDir==0 ){ |
| 219 | fossil_fatal("not found: %s", zName); |
| 220 | }else if( file_access(zName, R_OK) ){ |
| 221 | fossil_fatal("cannot open %s", zName); |
| 222 | }else{ |
| 223 | char *zTreeName = &zName[nRoot]; |
| 224 | db_multi_exec( |
| 225 | "INSERT OR IGNORE INTO sfile(x)" |
| 226 |
+2
-2
| --- src/allrepo.c | ||
| +++ src/allrepo.c | ||
| @@ -129,11 +129,11 @@ | ||
| 129 | 129 | " FROM global_config" |
| 130 | 130 | " WHERE substr(name, 1, 5)=='repo:' ORDER BY 1" |
| 131 | 131 | ); |
| 132 | 132 | while( db_step(&q)==SQLITE_ROW ){ |
| 133 | 133 | const char *zFilename = db_column_text(&q, 0); |
| 134 | - if( access(zFilename, 0) ){ | |
| 134 | + if( file_access(zFilename, 0) ){ | |
| 135 | 135 | nMissing++; |
| 136 | 136 | continue; |
| 137 | 137 | } |
| 138 | 138 | if( !file_is_canonical(zFilename) ) nMissing++; |
| 139 | 139 | if( zCmd[0]=='l' ){ |
| @@ -159,11 +159,11 @@ | ||
| 159 | 159 | if( nMissing ){ |
| 160 | 160 | db_begin_transaction(); |
| 161 | 161 | db_reset(&q); |
| 162 | 162 | while( db_step(&q)==SQLITE_ROW ){ |
| 163 | 163 | const char *zFilename = db_column_text(&q, 0); |
| 164 | - if( access(zFilename, 0) ){ | |
| 164 | + if( file_access(zFilename, 0) ){ | |
| 165 | 165 | char *zRepo = mprintf("repo:%s", zFilename); |
| 166 | 166 | db_unset(zRepo, 1); |
| 167 | 167 | free(zRepo); |
| 168 | 168 | }else if( !file_is_canonical(zFilename) ){ |
| 169 | 169 | Blob cname; |
| 170 | 170 |
| --- src/allrepo.c | |
| +++ src/allrepo.c | |
| @@ -129,11 +129,11 @@ | |
| 129 | " FROM global_config" |
| 130 | " WHERE substr(name, 1, 5)=='repo:' ORDER BY 1" |
| 131 | ); |
| 132 | while( db_step(&q)==SQLITE_ROW ){ |
| 133 | const char *zFilename = db_column_text(&q, 0); |
| 134 | if( access(zFilename, 0) ){ |
| 135 | nMissing++; |
| 136 | continue; |
| 137 | } |
| 138 | if( !file_is_canonical(zFilename) ) nMissing++; |
| 139 | if( zCmd[0]=='l' ){ |
| @@ -159,11 +159,11 @@ | |
| 159 | if( nMissing ){ |
| 160 | db_begin_transaction(); |
| 161 | db_reset(&q); |
| 162 | while( db_step(&q)==SQLITE_ROW ){ |
| 163 | const char *zFilename = db_column_text(&q, 0); |
| 164 | if( access(zFilename, 0) ){ |
| 165 | char *zRepo = mprintf("repo:%s", zFilename); |
| 166 | db_unset(zRepo, 1); |
| 167 | free(zRepo); |
| 168 | }else if( !file_is_canonical(zFilename) ){ |
| 169 | Blob cname; |
| 170 |
| --- src/allrepo.c | |
| +++ src/allrepo.c | |
| @@ -129,11 +129,11 @@ | |
| 129 | " FROM global_config" |
| 130 | " WHERE substr(name, 1, 5)=='repo:' ORDER BY 1" |
| 131 | ); |
| 132 | while( db_step(&q)==SQLITE_ROW ){ |
| 133 | const char *zFilename = db_column_text(&q, 0); |
| 134 | if( file_access(zFilename, 0) ){ |
| 135 | nMissing++; |
| 136 | continue; |
| 137 | } |
| 138 | if( !file_is_canonical(zFilename) ) nMissing++; |
| 139 | if( zCmd[0]=='l' ){ |
| @@ -159,11 +159,11 @@ | |
| 159 | if( nMissing ){ |
| 160 | db_begin_transaction(); |
| 161 | db_reset(&q); |
| 162 | while( db_step(&q)==SQLITE_ROW ){ |
| 163 | const char *zFilename = db_column_text(&q, 0); |
| 164 | if( file_access(zFilename, 0) ){ |
| 165 | char *zRepo = mprintf("repo:%s", zFilename); |
| 166 | db_unset(zRepo, 1); |
| 167 | free(zRepo); |
| 168 | }else if( !file_is_canonical(zFilename) ){ |
| 169 | Blob cname; |
| 170 |
+2
-2
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -54,11 +54,11 @@ | ||
| 54 | 54 | char *zFullName = mprintf("%s%s", g.zLocalRoot, zPathname); |
| 55 | 55 | blob_append(report, zPrefix, nPrefix); |
| 56 | 56 | if( isDeleted ){ |
| 57 | 57 | blob_appendf(report, "DELETED %s\n", zPathname); |
| 58 | 58 | }else if( !file_isfile(zFullName) ){ |
| 59 | - if( access(zFullName, 0)==0 ){ | |
| 59 | + if( file_access(zFullName, 0)==0 ){ | |
| 60 | 60 | blob_appendf(report, "NOT_A_FILE %s\n", zPathname); |
| 61 | 61 | if( missingIsFatal ){ |
| 62 | 62 | fossil_warning("not a file: %s", zPathname); |
| 63 | 63 | nErr++; |
| 64 | 64 | } |
| @@ -182,11 +182,11 @@ | ||
| 182 | 182 | }else if( isNew ){ |
| 183 | 183 | fossil_print("ADDED %s\n", zPathname); |
| 184 | 184 | }else if( isDeleted ){ |
| 185 | 185 | fossil_print("DELETED %s\n", zPathname); |
| 186 | 186 | }else if( !file_isfile(zFullName) ){ |
| 187 | - if( access(zFullName, 0)==0 ){ | |
| 187 | + if( file_access(zFullName, 0)==0 ){ | |
| 188 | 188 | fossil_print("NOT_A_FILE %s\n", zPathname); |
| 189 | 189 | }else{ |
| 190 | 190 | fossil_print("MISSING %s\n", zPathname); |
| 191 | 191 | } |
| 192 | 192 | }else if( chnged ){ |
| 193 | 193 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -54,11 +54,11 @@ | |
| 54 | char *zFullName = mprintf("%s%s", g.zLocalRoot, zPathname); |
| 55 | blob_append(report, zPrefix, nPrefix); |
| 56 | if( isDeleted ){ |
| 57 | blob_appendf(report, "DELETED %s\n", zPathname); |
| 58 | }else if( !file_isfile(zFullName) ){ |
| 59 | if( access(zFullName, 0)==0 ){ |
| 60 | blob_appendf(report, "NOT_A_FILE %s\n", zPathname); |
| 61 | if( missingIsFatal ){ |
| 62 | fossil_warning("not a file: %s", zPathname); |
| 63 | nErr++; |
| 64 | } |
| @@ -182,11 +182,11 @@ | |
| 182 | }else if( isNew ){ |
| 183 | fossil_print("ADDED %s\n", zPathname); |
| 184 | }else if( isDeleted ){ |
| 185 | fossil_print("DELETED %s\n", zPathname); |
| 186 | }else if( !file_isfile(zFullName) ){ |
| 187 | if( access(zFullName, 0)==0 ){ |
| 188 | fossil_print("NOT_A_FILE %s\n", zPathname); |
| 189 | }else{ |
| 190 | fossil_print("MISSING %s\n", zPathname); |
| 191 | } |
| 192 | }else if( chnged ){ |
| 193 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -54,11 +54,11 @@ | |
| 54 | char *zFullName = mprintf("%s%s", g.zLocalRoot, zPathname); |
| 55 | blob_append(report, zPrefix, nPrefix); |
| 56 | if( isDeleted ){ |
| 57 | blob_appendf(report, "DELETED %s\n", zPathname); |
| 58 | }else if( !file_isfile(zFullName) ){ |
| 59 | if( file_access(zFullName, 0)==0 ){ |
| 60 | blob_appendf(report, "NOT_A_FILE %s\n", zPathname); |
| 61 | if( missingIsFatal ){ |
| 62 | fossil_warning("not a file: %s", zPathname); |
| 63 | nErr++; |
| 64 | } |
| @@ -182,11 +182,11 @@ | |
| 182 | }else if( isNew ){ |
| 183 | fossil_print("ADDED %s\n", zPathname); |
| 184 | }else if( isDeleted ){ |
| 185 | fossil_print("DELETED %s\n", zPathname); |
| 186 | }else if( !file_isfile(zFullName) ){ |
| 187 | if( file_access(zFullName, 0)==0 ){ |
| 188 | fossil_print("NOT_A_FILE %s\n", zPathname); |
| 189 | }else{ |
| 190 | fossil_print("MISSING %s\n", zPathname); |
| 191 | } |
| 192 | }else if( chnged ){ |
| 193 |
M
src/db.c
+6
-6
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -728,11 +728,11 @@ | ||
| 728 | 728 | static int isValidLocalDb(const char *zDbName){ |
| 729 | 729 | i64 lsize; |
| 730 | 730 | int rc; |
| 731 | 731 | sqlite3_stmt *pStmt; |
| 732 | 732 | |
| 733 | - if( access(zDbName, F_OK) ) return 0; | |
| 733 | + if( file_access(zDbName, F_OK) ) return 0; | |
| 734 | 734 | lsize = file_size(zDbName); |
| 735 | 735 | if( lsize%1024!=0 || lsize<4096 ) return 0; |
| 736 | 736 | db_open_or_attach(zDbName, "localdb"); |
| 737 | 737 | g.localOpen = 1; |
| 738 | 738 | db_open_config(0); |
| @@ -803,11 +803,11 @@ | ||
| 803 | 803 | n = strlen(zPwd); |
| 804 | 804 | zPwdConv = mprintf("%/", zPwd); |
| 805 | 805 | strncpy(zPwd, zPwdConv, 2000-20); |
| 806 | 806 | free(zPwdConv); |
| 807 | 807 | while( n>0 ){ |
| 808 | - if( access(zPwd, W_OK) ) break; | |
| 808 | + if( file_access(zPwd, W_OK) ) break; | |
| 809 | 809 | for(i=0; i<sizeof(aDbName)/sizeof(aDbName[0]); i++){ |
| 810 | 810 | sqlite3_snprintf(sizeof(zPwd)-n, &zPwd[n], "%s", aDbName[i]); |
| 811 | 811 | if( isValidLocalDb(zPwd) ){ |
| 812 | 812 | /* Found a valid checkout database file */ |
| 813 | 813 | zPwd[n] = 0; |
| @@ -841,15 +841,15 @@ | ||
| 841 | 841 | } |
| 842 | 842 | if( zDbName==0 ){ |
| 843 | 843 | db_err("unable to find the name of a repository database"); |
| 844 | 844 | } |
| 845 | 845 | } |
| 846 | - if( access(zDbName, R_OK) || file_size(zDbName)<1024 ){ | |
| 847 | - if( access(zDbName, 0) ){ | |
| 846 | + if( file_access(zDbName, R_OK) || file_size(zDbName)<1024 ){ | |
| 847 | + if( file_access(zDbName, 0) ){ | |
| 848 | 848 | fossil_panic("repository does not exist or" |
| 849 | 849 | " is in an unreadable directory: %s", zDbName); |
| 850 | - }else if( access(zDbName, R_OK) ){ | |
| 850 | + }else if( file_access(zDbName, R_OK) ){ | |
| 851 | 851 | fossil_panic("read permission denied for repository %s", zDbName); |
| 852 | 852 | }else{ |
| 853 | 853 | fossil_panic("not a valid repository: %s", zDbName); |
| 854 | 854 | } |
| 855 | 855 | } |
| @@ -952,11 +952,11 @@ | ||
| 952 | 952 | fossil_fatal("not in a local checkout"); |
| 953 | 953 | return; |
| 954 | 954 | } |
| 955 | 955 | file_canonical_name(g.argv[2], &repo); |
| 956 | 956 | zRepo = blob_str(&repo); |
| 957 | - if( access(zRepo, 0) ){ | |
| 957 | + if( file_access(zRepo, 0) ){ | |
| 958 | 958 | fossil_fatal("no such file: %s", zRepo); |
| 959 | 959 | } |
| 960 | 960 | db_open_or_attach(zRepo, "test_repo"); |
| 961 | 961 | db_lset("repository", blob_str(&repo)); |
| 962 | 962 | db_close(1); |
| 963 | 963 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -728,11 +728,11 @@ | |
| 728 | static int isValidLocalDb(const char *zDbName){ |
| 729 | i64 lsize; |
| 730 | int rc; |
| 731 | sqlite3_stmt *pStmt; |
| 732 | |
| 733 | if( access(zDbName, F_OK) ) return 0; |
| 734 | lsize = file_size(zDbName); |
| 735 | if( lsize%1024!=0 || lsize<4096 ) return 0; |
| 736 | db_open_or_attach(zDbName, "localdb"); |
| 737 | g.localOpen = 1; |
| 738 | db_open_config(0); |
| @@ -803,11 +803,11 @@ | |
| 803 | n = strlen(zPwd); |
| 804 | zPwdConv = mprintf("%/", zPwd); |
| 805 | strncpy(zPwd, zPwdConv, 2000-20); |
| 806 | free(zPwdConv); |
| 807 | while( n>0 ){ |
| 808 | if( access(zPwd, W_OK) ) break; |
| 809 | for(i=0; i<sizeof(aDbName)/sizeof(aDbName[0]); i++){ |
| 810 | sqlite3_snprintf(sizeof(zPwd)-n, &zPwd[n], "%s", aDbName[i]); |
| 811 | if( isValidLocalDb(zPwd) ){ |
| 812 | /* Found a valid checkout database file */ |
| 813 | zPwd[n] = 0; |
| @@ -841,15 +841,15 @@ | |
| 841 | } |
| 842 | if( zDbName==0 ){ |
| 843 | db_err("unable to find the name of a repository database"); |
| 844 | } |
| 845 | } |
| 846 | if( access(zDbName, R_OK) || file_size(zDbName)<1024 ){ |
| 847 | if( access(zDbName, 0) ){ |
| 848 | fossil_panic("repository does not exist or" |
| 849 | " is in an unreadable directory: %s", zDbName); |
| 850 | }else if( access(zDbName, R_OK) ){ |
| 851 | fossil_panic("read permission denied for repository %s", zDbName); |
| 852 | }else{ |
| 853 | fossil_panic("not a valid repository: %s", zDbName); |
| 854 | } |
| 855 | } |
| @@ -952,11 +952,11 @@ | |
| 952 | fossil_fatal("not in a local checkout"); |
| 953 | return; |
| 954 | } |
| 955 | file_canonical_name(g.argv[2], &repo); |
| 956 | zRepo = blob_str(&repo); |
| 957 | if( access(zRepo, 0) ){ |
| 958 | fossil_fatal("no such file: %s", zRepo); |
| 959 | } |
| 960 | db_open_or_attach(zRepo, "test_repo"); |
| 961 | db_lset("repository", blob_str(&repo)); |
| 962 | db_close(1); |
| 963 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -728,11 +728,11 @@ | |
| 728 | static int isValidLocalDb(const char *zDbName){ |
| 729 | i64 lsize; |
| 730 | int rc; |
| 731 | sqlite3_stmt *pStmt; |
| 732 | |
| 733 | if( file_access(zDbName, F_OK) ) return 0; |
| 734 | lsize = file_size(zDbName); |
| 735 | if( lsize%1024!=0 || lsize<4096 ) return 0; |
| 736 | db_open_or_attach(zDbName, "localdb"); |
| 737 | g.localOpen = 1; |
| 738 | db_open_config(0); |
| @@ -803,11 +803,11 @@ | |
| 803 | n = strlen(zPwd); |
| 804 | zPwdConv = mprintf("%/", zPwd); |
| 805 | strncpy(zPwd, zPwdConv, 2000-20); |
| 806 | free(zPwdConv); |
| 807 | while( n>0 ){ |
| 808 | if( file_access(zPwd, W_OK) ) break; |
| 809 | for(i=0; i<sizeof(aDbName)/sizeof(aDbName[0]); i++){ |
| 810 | sqlite3_snprintf(sizeof(zPwd)-n, &zPwd[n], "%s", aDbName[i]); |
| 811 | if( isValidLocalDb(zPwd) ){ |
| 812 | /* Found a valid checkout database file */ |
| 813 | zPwd[n] = 0; |
| @@ -841,15 +841,15 @@ | |
| 841 | } |
| 842 | if( zDbName==0 ){ |
| 843 | db_err("unable to find the name of a repository database"); |
| 844 | } |
| 845 | } |
| 846 | if( file_access(zDbName, R_OK) || file_size(zDbName)<1024 ){ |
| 847 | if( file_access(zDbName, 0) ){ |
| 848 | fossil_panic("repository does not exist or" |
| 849 | " is in an unreadable directory: %s", zDbName); |
| 850 | }else if( file_access(zDbName, R_OK) ){ |
| 851 | fossil_panic("read permission denied for repository %s", zDbName); |
| 852 | }else{ |
| 853 | fossil_panic("not a valid repository: %s", zDbName); |
| 854 | } |
| 855 | } |
| @@ -952,11 +952,11 @@ | |
| 952 | fossil_fatal("not in a local checkout"); |
| 953 | return; |
| 954 | } |
| 955 | file_canonical_name(g.argv[2], &repo); |
| 956 | zRepo = blob_str(&repo); |
| 957 | if( file_access(zRepo, 0) ){ |
| 958 | fossil_fatal("no such file: %s", zRepo); |
| 959 | } |
| 960 | db_open_or_attach(zRepo, "test_repo"); |
| 961 | db_lset("repository", blob_str(&repo)); |
| 962 | db_close(1); |
| 963 |
+2
-2
| --- src/diffcmd.c | ||
| +++ src/diffcmd.c | ||
| @@ -100,11 +100,11 @@ | ||
| 100 | 100 | ** zFile2 */ |
| 101 | 101 | blob_zero(&nameFile1); |
| 102 | 102 | do{ |
| 103 | 103 | blob_reset(&nameFile1); |
| 104 | 104 | blob_appendf(&nameFile1, "%s~%d", zFile2, cnt++); |
| 105 | - }while( access(blob_str(&nameFile1),0)==0 ); | |
| 105 | + }while( file_access(blob_str(&nameFile1),0)==0 ); | |
| 106 | 106 | blob_write_to_file(pFile1, blob_str(&nameFile1)); |
| 107 | 107 | |
| 108 | 108 | /* Construct the external diff command */ |
| 109 | 109 | blob_zero(&cmd); |
| 110 | 110 | blob_appendf(&cmd, "%s ", zDiffCmd); |
| @@ -263,11 +263,11 @@ | ||
| 263 | 263 | char *zToFree = zFullName; |
| 264 | 264 | int showDiff = 1; |
| 265 | 265 | if( isDeleted ){ |
| 266 | 266 | diff_printf("DELETED %s\n", zPathname); |
| 267 | 267 | if( !asNewFile ){ showDiff = 0; zFullName = "/dev/null"; } |
| 268 | - }else if( access(zFullName, 0) ){ | |
| 268 | + }else if( file_access(zFullName, 0) ){ | |
| 269 | 269 | diff_printf("MISSING %s\n", zPathname); |
| 270 | 270 | if( !asNewFile ){ showDiff = 0; } |
| 271 | 271 | }else if( isNew ){ |
| 272 | 272 | diff_printf("ADDED %s\n", zPathname); |
| 273 | 273 | srcid = 0; |
| 274 | 274 |
| --- src/diffcmd.c | |
| +++ src/diffcmd.c | |
| @@ -100,11 +100,11 @@ | |
| 100 | ** zFile2 */ |
| 101 | blob_zero(&nameFile1); |
| 102 | do{ |
| 103 | blob_reset(&nameFile1); |
| 104 | blob_appendf(&nameFile1, "%s~%d", zFile2, cnt++); |
| 105 | }while( access(blob_str(&nameFile1),0)==0 ); |
| 106 | blob_write_to_file(pFile1, blob_str(&nameFile1)); |
| 107 | |
| 108 | /* Construct the external diff command */ |
| 109 | blob_zero(&cmd); |
| 110 | blob_appendf(&cmd, "%s ", zDiffCmd); |
| @@ -263,11 +263,11 @@ | |
| 263 | char *zToFree = zFullName; |
| 264 | int showDiff = 1; |
| 265 | if( isDeleted ){ |
| 266 | diff_printf("DELETED %s\n", zPathname); |
| 267 | if( !asNewFile ){ showDiff = 0; zFullName = "/dev/null"; } |
| 268 | }else if( access(zFullName, 0) ){ |
| 269 | diff_printf("MISSING %s\n", zPathname); |
| 270 | if( !asNewFile ){ showDiff = 0; } |
| 271 | }else if( isNew ){ |
| 272 | diff_printf("ADDED %s\n", zPathname); |
| 273 | srcid = 0; |
| 274 |
| --- src/diffcmd.c | |
| +++ src/diffcmd.c | |
| @@ -100,11 +100,11 @@ | |
| 100 | ** zFile2 */ |
| 101 | blob_zero(&nameFile1); |
| 102 | do{ |
| 103 | blob_reset(&nameFile1); |
| 104 | blob_appendf(&nameFile1, "%s~%d", zFile2, cnt++); |
| 105 | }while( file_access(blob_str(&nameFile1),0)==0 ); |
| 106 | blob_write_to_file(pFile1, blob_str(&nameFile1)); |
| 107 | |
| 108 | /* Construct the external diff command */ |
| 109 | blob_zero(&cmd); |
| 110 | blob_appendf(&cmd, "%s ", zDiffCmd); |
| @@ -263,11 +263,11 @@ | |
| 263 | char *zToFree = zFullName; |
| 264 | int showDiff = 1; |
| 265 | if( isDeleted ){ |
| 266 | diff_printf("DELETED %s\n", zPathname); |
| 267 | if( !asNewFile ){ showDiff = 0; zFullName = "/dev/null"; } |
| 268 | }else if( file_access(zFullName, 0) ){ |
| 269 | diff_printf("MISSING %s\n", zPathname); |
| 270 | if( !asNewFile ){ showDiff = 0; } |
| 271 | }else if( isNew ){ |
| 272 | diff_printf("ADDED %s\n", zPathname); |
| 273 | srcid = 0; |
| 274 |
+10
| --- src/file.c | ||
| +++ src/file.c | ||
| @@ -122,10 +122,20 @@ | ||
| 122 | 122 | }else{ |
| 123 | 123 | rc = getStat(0); |
| 124 | 124 | } |
| 125 | 125 | return rc ? 0 : (S_ISDIR(fileStat.st_mode) ? 1 : 2); |
| 126 | 126 | } |
| 127 | + | |
| 128 | +/* | |
| 129 | +** Wrapper around the access() system call. | |
| 130 | +*/ | |
| 131 | +int file_access(const char *zFilename, int flags){ | |
| 132 | + char *zMbcs = fossil_utf8_to_mbcs(zFilename); | |
| 133 | + int rc = access(zMbcs, flags); | |
| 134 | + fossil_mbcs_free(zMbcs); | |
| 135 | + return rc; | |
| 136 | +} | |
| 127 | 137 | |
| 128 | 138 | /* |
| 129 | 139 | ** Find an unused filename similar to zBase with zSuffix appended. |
| 130 | 140 | ** |
| 131 | 141 | ** Make the name relative to the working directory if relFlag is true. |
| 132 | 142 |
| --- src/file.c | |
| +++ src/file.c | |
| @@ -122,10 +122,20 @@ | |
| 122 | }else{ |
| 123 | rc = getStat(0); |
| 124 | } |
| 125 | return rc ? 0 : (S_ISDIR(fileStat.st_mode) ? 1 : 2); |
| 126 | } |
| 127 | |
| 128 | /* |
| 129 | ** Find an unused filename similar to zBase with zSuffix appended. |
| 130 | ** |
| 131 | ** Make the name relative to the working directory if relFlag is true. |
| 132 |
| --- src/file.c | |
| +++ src/file.c | |
| @@ -122,10 +122,20 @@ | |
| 122 | }else{ |
| 123 | rc = getStat(0); |
| 124 | } |
| 125 | return rc ? 0 : (S_ISDIR(fileStat.st_mode) ? 1 : 2); |
| 126 | } |
| 127 | |
| 128 | /* |
| 129 | ** Wrapper around the access() system call. |
| 130 | */ |
| 131 | int file_access(const char *zFilename, int flags){ |
| 132 | char *zMbcs = fossil_utf8_to_mbcs(zFilename); |
| 133 | int rc = access(zMbcs, flags); |
| 134 | fossil_mbcs_free(zMbcs); |
| 135 | return rc; |
| 136 | } |
| 137 | |
| 138 | /* |
| 139 | ** Find an unused filename similar to zBase with zSuffix appended. |
| 140 | ** |
| 141 | ** Make the name relative to the working directory if relFlag is true. |
| 142 |
+1
-1
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -1332,11 +1332,11 @@ | ||
| 1332 | 1332 | int bExists; |
| 1333 | 1333 | while( zPath && zPath[0] ){ |
| 1334 | 1334 | while( zPath[0]==':' ) zPath++; |
| 1335 | 1335 | for(i=0; zPath[i] && zPath[i]!=':'; i++){} |
| 1336 | 1336 | zFull = mprintf("%.*s/%s", i, zPath, zBinary); |
| 1337 | - bExists = access(zFull, X_OK); | |
| 1337 | + bExists = file_access(zFull, X_OK); | |
| 1338 | 1338 | free(zFull); |
| 1339 | 1339 | if( bExists==0 ) return 1; |
| 1340 | 1340 | zPath += i; |
| 1341 | 1341 | } |
| 1342 | 1342 | return 0; |
| 1343 | 1343 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -1332,11 +1332,11 @@ | |
| 1332 | int bExists; |
| 1333 | while( zPath && zPath[0] ){ |
| 1334 | while( zPath[0]==':' ) zPath++; |
| 1335 | for(i=0; zPath[i] && zPath[i]!=':'; i++){} |
| 1336 | zFull = mprintf("%.*s/%s", i, zPath, zBinary); |
| 1337 | bExists = access(zFull, X_OK); |
| 1338 | free(zFull); |
| 1339 | if( bExists==0 ) return 1; |
| 1340 | zPath += i; |
| 1341 | } |
| 1342 | return 0; |
| 1343 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -1332,11 +1332,11 @@ | |
| 1332 | int bExists; |
| 1333 | while( zPath && zPath[0] ){ |
| 1334 | while( zPath[0]==':' ) zPath++; |
| 1335 | for(i=0; zPath[i] && zPath[i]!=':'; i++){} |
| 1336 | zFull = mprintf("%.*s/%s", i, zPath, zBinary); |
| 1337 | bExists = file_access(zFull, X_OK); |
| 1338 | free(zFull); |
| 1339 | if( bExists==0 ) return 1; |
| 1340 | zPath += i; |
| 1341 | } |
| 1342 | return 0; |
| 1343 |
+1
-1
| --- src/rebuild.c | ||
| +++ src/rebuild.c | ||
| @@ -911,11 +911,11 @@ | ||
| 911 | 911 | }else{ |
| 912 | 912 | fossil_fatal("N(%s) is not a a valid prefix length!",zPrefixOpt); |
| 913 | 913 | } |
| 914 | 914 | } |
| 915 | 915 | #ifndef _WIN32 |
| 916 | - if( access(zDestDir, W_OK) ){ | |
| 916 | + if( file_access(zDestDir, W_OK) ){ | |
| 917 | 917 | fossil_fatal("DESTINATION(%s) is not writeable!",zDestDir); |
| 918 | 918 | } |
| 919 | 919 | #else |
| 920 | 920 | /* write access on windows is not checked, errors will be |
| 921 | 921 | ** dected on blob_write_to_file |
| 922 | 922 |
| --- src/rebuild.c | |
| +++ src/rebuild.c | |
| @@ -911,11 +911,11 @@ | |
| 911 | }else{ |
| 912 | fossil_fatal("N(%s) is not a a valid prefix length!",zPrefixOpt); |
| 913 | } |
| 914 | } |
| 915 | #ifndef _WIN32 |
| 916 | if( access(zDestDir, W_OK) ){ |
| 917 | fossil_fatal("DESTINATION(%s) is not writeable!",zDestDir); |
| 918 | } |
| 919 | #else |
| 920 | /* write access on windows is not checked, errors will be |
| 921 | ** dected on blob_write_to_file |
| 922 |
| --- src/rebuild.c | |
| +++ src/rebuild.c | |
| @@ -911,11 +911,11 @@ | |
| 911 | }else{ |
| 912 | fossil_fatal("N(%s) is not a a valid prefix length!",zPrefixOpt); |
| 913 | } |
| 914 | } |
| 915 | #ifndef _WIN32 |
| 916 | if( file_access(zDestDir, W_OK) ){ |
| 917 | fossil_fatal("DESTINATION(%s) is not writeable!",zDestDir); |
| 918 | } |
| 919 | #else |
| 920 | /* write access on windows is not checked, errors will be |
| 921 | ** dected on blob_write_to_file |
| 922 |