зеркало из https://github.com/mozilla/pjs.git
In ntio.c, w95io.c, _PR_MD_OPEN, handle all combinations of
PR_CREATE_FILE and PR_TRUNCATE correctly.
This commit is contained in:
Родитель
0335df2546
Коммит
9737f7d3c0
|
@ -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
|
||||||
|
flags = OPEN_ALWAYS;
|
||||||
|
} else {
|
||||||
|
if (osflags & PR_TRUNCATE)
|
||||||
|
flags = TRUNCATE_EXISTING;
|
||||||
else
|
else
|
||||||
flags = OPEN_EXISTING;
|
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
|
||||||
|
flags = OPEN_ALWAYS;
|
||||||
|
} else {
|
||||||
|
if (osflags & PR_TRUNCATE)
|
||||||
|
flags = TRUNCATE_EXISTING;
|
||||||
else
|
else
|
||||||
flags = OPEN_EXISTING;
|
flags = OPEN_EXISTING;
|
||||||
|
}
|
||||||
|
|
||||||
file = CreateFile(name,
|
file = CreateFile(name,
|
||||||
access,
|
access,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче