Closed Bug 33740 Opened 25 years ago Closed 25 years ago

need to change os2io.c for write errors and create new files

Categories

(NSPR :: NSPR, defect, P3)

x86
OS/2
defect

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: snizinsk, Assigned: wtc)

Details

Attachments

(1 file)

OS/2 bring-up requires the following changes to os2io.c: 1. Changed write() to DosWrite(). EMX i/o calls cannot be intermixed with DosXXX calls since EMX remaps file/socket handles. 2. Change default behavior of Open to be like NT whereby if a file doesn't exist, we will create it (NT uses OPEN_ALWAYS). This is preventing creation of mail folders since the only flag passed in when folders are created is PR_RDONLY.
Attached file Diff of changes to os2io.c (deleted) —
Reassigned the bug to me.
Assignee: srinivas → wtc
QA Contact: srinivas → wtc
I have the following questions after reviewing the patch. 1. Regarding the change of write() to DosWrite(): there is a comment in the original code that bothers me: No longer using DosWrite since it doesn't convert \n to \n\r like C runtime does Seems like that's why DosWrite() was changed to write() before. However, that reason is invalid because _PR_MD_WRITE() is binary-mode only, so it must not convert \n to \n\r. So I think that comment was a misunderstanding of what _PR_MD_WRITE() is supposed to do and we should remove the comment. 2. Regarding the second change, you said: Change default behavior of Open to be like NT whereby if a file doesn't exist, we will create it (NT uses OPEN_ALWAYS). This is preventing creation of mail folders since the only flag passed in when folders are created is PR_RDONLY. This change is wrong. If NT creates a nonexisting file by default, our NT code is wrong. I just checked our NT code and it uses OPEN_ALWAYS only if PR_CREATE_FILE is specified. Since you said the only flag passed in when mail folders are created is PR_RDONLY, we shouldn't be using OPEN_ALWAYS on NT. Could you please check that again? Thanks.
Status: NEW → ASSIGNED
I agree on both points and have made the modifications...here's a new diff. Thanks. Index: os2io.c =================================================================== RCS file: /cvsroot/mozilla/nsprpub/pr/src/md/os2/os2io.c,v retrieving revision 3.5 diff -p -r3.5 os2io.c *** os2io.c 2000/01/10 21:08:35 3.5 --- os2io.c 2000/04/03 20:06:42 *************** *** 14,19 **** --- 14,31 ---- * Communications Corporation. Portions created by Netscape are * Copyright (C) 1998 Netscape Communications Corporation. All Rights * Reserved. + * + * This Original Code has been modified by IBM Corporation. + * Modifications made by IBM described herein are + * Copyright (c) International Business Machines + * Corporation, 2000 + * + * Modifications to Mozilla code or documentation + * identified per MPL Section 3.3 + * + * Date Modified by Description of modification + * 03/23/2000 IBM Corp. Changed write() to DosWrite(). EMX i/o calls cannot be intermixed + * with DosXXX calls since EMX remaps file/socket handles. */ /* OS2 IO module *************** _PR_MD_WRITE(PRFileDesc *fd, const void *** 182,204 **** PRInt32 bytes; int rv; - /* No longer using DosWrite since it doesn't convert \n to \n\r like C runtime does */ - #if 0 rv = DosWrite((HFILE)fd->secret->md.osfd, (PVOID)buf, len, ! &bytes); if (rv != NO_ERROR) { ! _PR_MD_MAP_WRITE_ERROR(rv); return -1; } - #else - bytes = write(fd->secret->md.osfd, buf, len); - if (bytes == -1) - _PR_MD_MAP_WRITE_ERROR(errno); - #endif return bytes; } /* --- end _PR_MD_WRITE() --- */ --- 194,209 ---- PRInt32 bytes; int rv; rv = DosWrite((HFILE)fd->secret->md.osfd, (PVOID)buf, len, ! (PULONG) &bytes); if (rv != NO_ERROR) { ! _PR_MD_MAP_WRITE_ERROR(rv); return -1; } return bytes; } /* --- end _PR_MD_WRITE() --- */
Checked in the patch on the main trunk. /cvsroot/mozilla/nsprpub/pr/src/md/os2/os2io.c, revision 3.6 Checked in the patch on the NSPRPUB_RELEASE_4_0_BRANCH. /cvsroot/mozilla/nsprpub/pr/src/md/os2/os2io.c, revision 3.5.4.1 Will check in the patch on the NSPRPUB_CLIENT_BRANCH (which the mozilla client pulls) when the mozilla tree reopens.
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Checked in the patch on the NSPRPUB_CLIENT_BRANCH. /cvsroot/mozilla/nsprpub/pr/src/md/os2/os2io.c, revision 3.5.18.1
Target Milestone: --- → 4.0.1
Target Milestone: 4.0.1 → 4.0.2
Verified
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: