In ntio.c, w95io.c, _PR_MD_OPEN, handle all combinations of

PR_CREATE_FILE and PR_TRUNCATE correctly.
This commit is contained in:
wtc%netscape.com 1998-12-15 03:58:53 +00:00
Родитель 0335df2546
Коммит 9737f7d3c0
2 изменённых файлов: 23 добавлений и 13 удалений

Просмотреть файл

@ -1779,7 +1779,7 @@ _PR_MD_OPEN(const char *name, PRIntn osflags, PRIntn mode)
if (osflags & PR_CREATE_FILE) if (osflags & PR_CREATE_FILE)
flags = (0 != (osflags & PR_TRUNCATE)) ? CREATE_ALWAYS : OPEN_ALWAYS; flags = (0 != (osflags & PR_TRUNCATE)) ? CREATE_ALWAYS : OPEN_ALWAYS;
else if (osflags & PR_TRUNCATE) flags = CREATE_ALWAYS; else if (osflags & PR_TRUNCATE) flags = TRUNCATE_EXISTING;
else flags = OPEN_EXISTING; else flags = OPEN_EXISTING;
flag6 |= FILE_FLAG_OVERLAPPED; flag6 |= FILE_FLAG_OVERLAPPED;
@ -1818,12 +1818,17 @@ _PR_MD_OPEN(const char *name, PRIntn osflags, PRIntn mode)
access |= GENERIC_READ; access |= GENERIC_READ;
if (osflags & PR_WRONLY || osflags & PR_RDWR) if (osflags & PR_WRONLY || osflags & PR_RDWR)
access |= GENERIC_WRITE; access |= GENERIC_WRITE;
if (osflags & PR_CREATE_FILE) if (osflags & PR_CREATE_FILE) {
flags = OPEN_ALWAYS; if (osflags & PR_TRUNCATE)
else if (osflags & PR_TRUNCATE) flags = CREATE_ALWAYS;
flags = CREATE_ALWAYS; else
else flags = OPEN_ALWAYS;
flags = OPEN_EXISTING; } else {
if (osflags & PR_TRUNCATE)
flags = TRUNCATE_EXISTING;
else
flags = OPEN_EXISTING;
}
file = CreateFile(name, file = CreateFile(name,
access, access,

Просмотреть файл

@ -145,12 +145,17 @@ _PR_MD_OPEN(const char *name, PRIntn osflags, int mode)
access |= GENERIC_READ; access |= GENERIC_READ;
if (osflags & PR_WRONLY || osflags & PR_RDWR) if (osflags & PR_WRONLY || osflags & PR_RDWR)
access |= GENERIC_WRITE; access |= GENERIC_WRITE;
if (osflags & PR_CREATE_FILE) if (osflags & PR_CREATE_FILE) {
flags = OPEN_ALWAYS; if (osflags & PR_TRUNCATE)
else if (osflags & PR_TRUNCATE) flags = CREATE_ALWAYS;
flags = CREATE_ALWAYS; else
else flags = OPEN_ALWAYS;
flags = OPEN_EXISTING; } else {
if (osflags & PR_TRUNCATE)
flags = TRUNCATE_EXISTING;
else
flags = OPEN_EXISTING;
}
file = CreateFile(name, file = CreateFile(name,
access, access,