mirror of
https://github.com/fadden/nulib2.git
synced 2024-12-27 17:29:57 +00:00
Correct handling of MS-DOS reserved names.
This commit is contained in:
parent
f87168ce85
commit
376b8c93d8
@ -683,7 +683,7 @@ BNYUnSqueeze(BNYArchive* pBny, BNYEntry* pEntry, FILE* outfp)
|
||||
*/
|
||||
Assert(kSqBufferSize > 1200);
|
||||
#ifdef FULL_SQ_HEADER
|
||||
err = USQReadShort(&usqState, &magic);
|
||||
err = USQReadShort(&usqState, (short*) &magic);
|
||||
if (err != kNuErrNone)
|
||||
goto bail;
|
||||
if (magic != kNuSQMagic) {
|
||||
@ -692,7 +692,7 @@ BNYUnSqueeze(BNYArchive* pBny, BNYEntry* pEntry, FILE* outfp)
|
||||
goto bail;
|
||||
}
|
||||
|
||||
err = USQReadShort(&usqState, &fileChecksum);
|
||||
err = USQReadShort(&usqState, (short*) &fileChecksum);
|
||||
if (err != kNuErrNone)
|
||||
goto bail;
|
||||
|
||||
|
@ -1,3 +1,9 @@
|
||||
2006/02/18 ***** v2.1.1 shipped *****
|
||||
|
||||
2006/02/18 fadden
|
||||
- Fix handling of MS-DOS reserved names. Besides handling names like
|
||||
"con", we also need to handle "con.foo.txt".
|
||||
|
||||
2005/09/17 ***** v2.1.0 shipped *****
|
||||
|
||||
2004/10/11 ***** v2.0.3 shipped *****
|
||||
|
@ -115,6 +115,9 @@ UNIXNormalizeFileName(NulibState* pState, const char* srcp, long srcLen,
|
||||
* a '_' (if we're not preserving filenames) or "%00" (if we are). The
|
||||
* "%00" sequence gets stripped off during denormalization.
|
||||
*
|
||||
* For some reason FAT is actually even more picky than that, insisting
|
||||
* that files like "CON.FOO.TXT" are also illegal.
|
||||
*
|
||||
* The list comes from the Linux kernel's fs/msdos/namei.c.
|
||||
*/
|
||||
static const char* fatReservedNames3[] = {
|
||||
@ -135,12 +138,14 @@ Win32NormalizeFileName(NulibState* pState, const char* srcp, long srcLen,
|
||||
const char* startp = srcp;
|
||||
static const char* kInvalid = "\\/:*?\"<>|";
|
||||
|
||||
/* look for an exact match */
|
||||
if (srcLen == 3) {
|
||||
/* look for a match on "aux" or "aux\..*" */
|
||||
if (srcLen >= 3) {
|
||||
const char** ppcch;
|
||||
|
||||
for (ppcch = fatReservedNames3; *ppcch != nil; ppcch++) {
|
||||
if (strncasecmp(srcp, *ppcch, srcLen) == 0) {
|
||||
if (strncasecmp(srcp, *ppcch, 3) == 0 &&
|
||||
srcp[3] == '.' || srcLen == 3)
|
||||
{
|
||||
DBUG(("--- fixing '%s'\n", *ppcch));
|
||||
if (NState_GetModPreserveType(pState)) {
|
||||
*dstp++ = kForeignIndic;
|
||||
@ -151,11 +156,14 @@ Win32NormalizeFileName(NulibState* pState, const char* srcp, long srcLen,
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (srcLen == 4) {
|
||||
}
|
||||
if (srcLen >= 4) {
|
||||
const char** ppcch;
|
||||
|
||||
for (ppcch = fatReservedNames4; *ppcch != nil; ppcch++) {
|
||||
if (strncasecmp(srcp, *ppcch, srcLen) == 0) {
|
||||
if (strncasecmp(srcp, *ppcch, 4) == 0 &&
|
||||
srcp[4] == '.' || srcLen == 4)
|
||||
{
|
||||
DBUG(("--- fixing '%s'\n", *ppcch));
|
||||
if (NState_GetModPreserveType(pState)) {
|
||||
*dstp++ = kForeignIndic;
|
||||
|
Loading…
Reference in New Issue
Block a user