Show More
@@ -436,7 +436,14 b' static PyObject *posixfile(PyObject *sel' | |||
|
436 | 436 | } |
|
437 | 437 | else |
|
438 | 438 | flags = _O_TEXT; |
|
439 | if (plus) { | |
|
439 | if (m0 == 'r' && !plus) { | |
|
440 | flags |= _O_RDONLY; | |
|
441 | access = GENERIC_READ; | |
|
442 | } else { | |
|
443 | /* | |
|
444 | work around http://support.microsoft.com/kb/899149 and | |
|
445 | set _O_RDWR for 'w' and 'a', even if mode has no '+' | |
|
446 | */ | |
|
440 | 447 | flags |= _O_RDWR; |
|
441 | 448 | access = GENERIC_READ | GENERIC_WRITE; |
|
442 | 449 | fpmode[fppos++] = '+'; |
@@ -446,25 +453,13 b' static PyObject *posixfile(PyObject *sel' | |||
|
446 | 453 | switch (m0) { |
|
447 | 454 | case 'r': |
|
448 | 455 | creation = OPEN_EXISTING; |
|
449 | if (!plus) { | |
|
450 | flags |= _O_RDONLY; | |
|
451 | access = GENERIC_READ; | |
|
452 | } | |
|
453 | 456 | break; |
|
454 | 457 | case 'w': |
|
455 | 458 | creation = CREATE_ALWAYS; |
|
456 | if (!plus) { | |
|
457 | access = GENERIC_WRITE; | |
|
458 | flags |= _O_WRONLY; | |
|
459 | } | |
|
460 | 459 | break; |
|
461 | 460 | case 'a': |
|
462 | 461 | creation = OPEN_ALWAYS; |
|
463 | 462 | flags |= _O_APPEND; |
|
464 | if (!plus) { | |
|
465 | flags |= _O_WRONLY; | |
|
466 | access = GENERIC_WRITE; | |
|
467 | } | |
|
468 | 463 | break; |
|
469 | 464 | default: |
|
470 | 465 | PyErr_Format(PyExc_ValueError, |
General Comments 0
You need to be logged in to leave comments.
Login now