Changeset 1324
- Timestamp:
- Mar 21, 2004, 7:37:19 AM (21 years ago)
- Location:
- trunk/src/emx
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/emx/src/lib/libc.def
-
Property cvs2svn:cvs-rev
changed from
1.52
to1.53
r1323 r1324 1093 1093 "_catgets" @1116 1094 1094 "_catopen" @1117 1095 "___libc_PathRewrite" @1118 1096 "___libc_PathRewriteAdd" @1119 1097 "___libc_PathRewriteRemove" @1120 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/__open.c
-
Property cvs2svn:cvs-rev
changed from
1.7
to1.8
r1323 r1324 15 15 #include <alloca.h> 16 16 #include "syscalls.h" 17 #include <InnoTekLIBC/pathrewrite.h> 18 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_IO 19 #include <InnoTekLIBC/logstrict.h> 17 20 18 21 int __open(const char *pszFile, int flags, off_t cbInitial, unsigned fLibc, PLIBCFH *ppFH) 19 22 { 23 LIBCLOG_ENTER("pszFile=%s flags=%#x cbInitial=%lld fLibc=%#x ppFH=%p\n", 24 pszFile, flags, cbInitial, fLibc, (void*)ppFH); 20 25 ULONG rc; 21 26 ULONG flOpenMode; … … 24 29 ULONG ulAction; 25 30 HFILE hFile; 31 int cch; 26 32 int failed_open_errno; 27 33 FS_VAR(); 28 34 35 29 36 /* 30 * Interpret "/dev/null" as the pszFile of the null device "NUL". 31 * Interpret "/dev/tty" as the pszFile of the console device "CON". 37 * Rewrite the specified file path. 32 38 */ 33 if (!strcmp(pszFile, "/dev/null")) 34 pszFile = "nul"; 35 else if (!strcmp(pszFile, "/dev/tty")) 36 pszFile = "con"; 39 cch = __libc_PathRewrite(pszFile, NULL, 0); 40 if (cch > 0) 41 { 42 char *pszRewritten = alloca(cch); 43 if (!pszRewritten) 44 { 45 errno = ENOMEM; 46 LIBCLOG_RETURN_INT(-1); 47 } 48 cch = __libc_PathRewrite(pszFile, pszRewritten, cch); 49 if (cch > 0) 50 pszFile = pszRewritten; 51 /* else happens when someone changes the rules between the two calls. */ 52 else if (cch < 0) 53 { 54 errno = EAGAIN; /* non-standard, I'm sure. */ 55 LIBCLOG_RETURN_INT(-1); 56 } 57 } 37 58 38 59 /* … … 98 119 { 99 120 strcpy(pszFile_safe, pszFile); 100 rc = __pfnDosOpenL( pszFile_safe, &hFile, &ulAction, cbInitialTmp, flAttr, flOpenFlags, flOpenMode, NULL);121 rc = __pfnDosOpenL((PCSZ)pszFile_safe, &hFile, &ulAction, cbInitialTmp, flAttr, flOpenFlags, flOpenMode, NULL); 101 122 } 102 123 else … … 110 131 FS_RESTORE(); 111 132 errno = EOVERFLOW; 112 return -1;133 LIBCLOG_RETURN_INT(-1); 113 134 } 114 rc = DosOpen( pszFile, &hFile, &ulAction, cbInitialTmp, flAttr, flOpenFlags, flOpenMode, NULL);135 rc = DosOpen((PCSZ)pszFile, &hFile, &ulAction, cbInitialTmp, flAttr, flOpenFlags, flOpenMode, NULL); 115 136 } 116 137 #else 117 138 { 118 139 ULONG cbInitialTmp = cbInitial; 119 rc = DosOpen( pszFile, &hFile, &ulAction, cbInitialTmp, flAttr, flOpenFlags, flOpenMode, NULL);140 rc = DosOpen((PCSZ)pszFile, &hFile, &ulAction, cbInitialTmp, flAttr, flOpenFlags, flOpenMode, NULL); 120 141 } 121 142 #endif … … 150 171 */ 151 172 rc = __libc_FHAllocate(hFile, fLibc, sizeof(LIBCFH), NULL, ppFH, NULL); 173 LIBCLOG_MSG("hFile=%#lx fLibc=%#x fulType=%#lx ulAction=%lu\n", 174 hFile, fLibc, fulType, ulAction); 152 175 } 153 176 … … 166 189 else 167 190 _sys_set_errno(rc); 168 return -1;191 LIBCLOG_RETURN_INT(-1); 169 192 } 170 193 return hFile; -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.