Fossil SCM

As it turns out that _wstati64() cannot handled the special "\\?\" prefix, work around that. Otherwise the win32-longpath VFS is quite useless for fossil. Maybe a better solution should be worked out, not using _wstati64() at all.

jan.nijtmans 2013-12-11 13:00 trunk
Commit bb440899d387093de73c079c4565a811705e6f83
1 file changed +11 -1
+11 -1
--- src/file.c
+++ src/file.c
@@ -74,11 +74,21 @@
7474
}else{
7575
rc = stat(zMbcs, buf);
7676
}
7777
#else
7878
wchar_t *zMbcs = fossil_utf8_to_filename(zFilename);
79
- rc = _wstati64(zMbcs, buf);
79
+ if( memcmp(zMbcs, L"\\\\?\\", 8)==0 ){
80
+ /* Unfortunately, _wstati64 cannot handle extended prefixes. */
81
+ if( memcmp(zMbcs+4, "UNC\\", 8)==0 ){
82
+ zMbcs[6] = '\\';
83
+ rc = _wstati64(zMbcs+6, buf);
84
+ }else{
85
+ rc = _wstati64(zMbcs+4, buf);
86
+ }
87
+ }else{
88
+ rc = _wstati64(zMbcs, buf);
89
+ }
8090
#endif
8191
fossil_filename_free(zMbcs);
8292
return rc;
8393
}
8494
8595
--- src/file.c
+++ src/file.c
@@ -74,11 +74,21 @@
74 }else{
75 rc = stat(zMbcs, buf);
76 }
77 #else
78 wchar_t *zMbcs = fossil_utf8_to_filename(zFilename);
79 rc = _wstati64(zMbcs, buf);
 
 
 
 
 
 
 
 
 
 
80 #endif
81 fossil_filename_free(zMbcs);
82 return rc;
83 }
84
85
--- src/file.c
+++ src/file.c
@@ -74,11 +74,21 @@
74 }else{
75 rc = stat(zMbcs, buf);
76 }
77 #else
78 wchar_t *zMbcs = fossil_utf8_to_filename(zFilename);
79 if( memcmp(zMbcs, L"\\\\?\\", 8)==0 ){
80 /* Unfortunately, _wstati64 cannot handle extended prefixes. */
81 if( memcmp(zMbcs+4, "UNC\\", 8)==0 ){
82 zMbcs[6] = '\\';
83 rc = _wstati64(zMbcs+6, buf);
84 }else{
85 rc = _wstati64(zMbcs+4, buf);
86 }
87 }else{
88 rc = _wstati64(zMbcs, buf);
89 }
90 #endif
91 fossil_filename_free(zMbcs);
92 return rc;
93 }
94
95

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button