Changeset 2496 for branches/libc-0.6
- Timestamp:
- Dec 18, 2005, 9:56:19 AM (20 years ago)
- Location:
- branches/libc-0.6/src/emx
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/libc-0.6/src/emx/ChangeLog.LIBC
r2495 r2496 4 4 5 5 2005-12-18: knut st. osmundsen <bird-gccos2-spam@anduin.net> 6 - libc: 7 o #22: Added DosFindFirst() as fallback when DosQueryPathInfo() fails 8 to query the symlink EA in the path resolver. This problem occurs 9 when doing stat() on an open file (pwd_mkdb example). 6 10 - emxomfld: 7 11 o Don't display usage() on failure, just the error message. -
branches/libc-0.6/src/emx/src/lib/sys/fs.c
r2495 r2496 973 973 * This'll of course also provide proper verification of the path too. :-) 974 974 * 975 * (This is a little bit messed up since we'll have to use wildcard for976 * getting the cas eing resolved.)975 * This is a little bit messed up since we'll have to use wildcard for 976 * getting the casing resolved. 977 977 */ 978 978 //LIBC_ASSERT(psz - pszNativePath == cchNativePath); - figure this one. … … 987 987 psz[1] = chNext; 988 988 if (rc || cFiles == 0) 989 {990 989 hDir = HDIR_CREATE; 991 }992 990 while (!rc && cFiles == 1 && pFindBuf->cchName != psz - pszPrev) 993 991 rc = DosFindNext(hDir, pFindBuf, SIZEOF_ACHBUFFER, &cFiles); … … 1008 1006 1009 1007 /* 1010 * Try querying the symlink EA value 1008 * Try querying the symlink EA value. 1011 1009 * (This operation will reuse the achBuffer overwriting the pFindBuf data!) 1012 1010 * … … 1015 1013 * returning the right things at some point, and besides it's return data 1016 1014 * is rather clumsily laid out. So, I decided not to try my luck on it. 1015 * 1016 * On second thought, we seems to end up having to use DosFindFirst in some 1017 * cases anyway... very nice. 1017 1018 */ 1018 1019 if ( pFindBuf->cbList > sizeof(USHORT) * 2 + 1 1019 1020 && ( (fFlags & BACKFS_FLAGS_RESOLVE_FULL) 1020 || chSlash)) 1021 { 1022 EAOP2 EaOp; 1023 EaOp.fpGEA2List = (PGEA2LIST)&gGEA2ListSymlink; 1024 EaOp.fpFEA2List = (PFEA2LIST)pachBuffer; 1025 EaOp.oError = 0; 1026 EaOp.fpFEA2List->cbList = SIZEOF_ACHBUFFER; 1027 rc = DosQueryPathInfo((PCSZ)pszNativePath, FIL_QUERYEASFROMLIST, &EaOp, sizeof(EaOp)); 1021 || chSlash) 1022 && !(pFindBuf->attrFile & FILE_DIRECTORY)) 1023 { 1024 PEAOP2 pEaOp2 = (PEAOP2)pachBuffer; 1025 pEaOp2->fpGEA2List = (PGEA2LIST)&gGEA2ListSymlink; 1026 pEaOp2->fpFEA2List = (PFEA2LIST)(pEaOp2 + 1); 1027 pEaOp2->oError = 0; 1028 pEaOp2->fpFEA2List->cbList = SIZEOF_ACHBUFFER - sizeof(*pEaOp2); 1029 rc = DosQueryPathInfo((PCSZ)pszNativePath, FIL_QUERYEASFROMLIST, pEaOp2, sizeof(*pEaOp2)); 1028 1030 if (rc) 1029 1031 { 1030 LIBCLOG_MSG("DosQueryPathInfo('%s',,,) -> %d resolving '%s'\n", pszNativePath, rc, pszUserPathIn); 1031 if ((fFlags & BACKFS_FLAGS_RESOLVE_FULL_MAYBE_) && !chSlash) 1032 rcRet = 0; 1033 else 1034 rcRet = rc == ERROR_FILE_NOT_FOUND && chSlash ? -ENOENT : -__libc_native2errno(rc); 1035 break; 1032 cFiles = 1; 1033 pEaOp2->fpGEA2List = (PGEA2LIST)&gGEA2ListSymlink; 1034 pEaOp2->fpFEA2List = (PFEA2LIST)(pEaOp2 + 1); 1035 pEaOp2->oError = 0; 1036 pEaOp2->fpFEA2List->cbList = SIZEOF_ACHBUFFER - sizeof(*pEaOp2); 1037 rc = DosFindFirst((PCSZ)pszNativePath, &hDir, 0, pEaOp2, pEaOp2->fpFEA2List->cbList + sizeof(*pEaOp2), &cFiles, FIL_QUERYEASFROMLIST); 1038 if (rc || cFiles == 0) 1039 { 1040 hDir = HDIR_CREATE; 1041 LIBCLOG_MSG("DosFindFirst('%s',,,pEaOp2,) -> %d resolving '%s'\n", pszNativePath, rc, pszUserPathIn); 1042 if ((fFlags & BACKFS_FLAGS_RESOLVE_FULL_MAYBE_) && !chSlash) 1043 rcRet = 0; 1044 else 1045 rcRet = rc == ERROR_FILE_NOT_FOUND && chSlash ? -ENOENT : -__libc_native2errno(rc); 1046 break; 1047 } 1048 pEaOp2->fpFEA2List = (PFEA2LIST)((char *)pEaOp2 + sizeof(EAOP2) + offsetof(FILEFINDBUF3, cchName)); 1036 1049 } 1037 1050 … … 1039 1052 * Did we find any symlink EA? 1040 1053 */ 1041 if ( EaOp.fpFEA2List->cbList > sizeof(EaOp.fpFEA2List->list[0])1042 && EaOp.fpFEA2List->list[0].cbValue)1054 if ( pEaOp2->fpFEA2List->cbList > sizeof(pEaOp2->fpFEA2List->list[0]) 1055 && pEaOp2->fpFEA2List->list[0].cbValue) 1043 1056 { 1044 1057 /* Validate the EA. */ 1045 PUSHORT pusType = (PUSHORT)((char *)& EaOp.fpFEA2List->list[1] + EaOp.fpFEA2List->list[0].cbName);1058 PUSHORT pusType = (PUSHORT)((char *)&pEaOp2->fpFEA2List->list[1] + pEaOp2->fpFEA2List->list[0].cbName); 1046 1059 char *pszSymlink = (char *)&pusType[2]; 1047 1060 if ( pusType[0] != EAT_ASCII 1048 || pusType[1] > EaOp.fpFEA2List->list[0].cbValue1061 || pusType[1] > pEaOp2->fpFEA2List->list[0].cbValue 1049 1062 || !pusType[1] 1050 1063 || !*pszSymlink) 1051 1064 { 1052 1065 LIBCLOG_ERROR("Invalid symlink EA! type=%x len=%d cbValue=%d *pszSymlink=%c\n", 1053 pusType[0], pusType[1], EaOp.fpFEA2List->list[0].cbValue, *pszSymlink);1066 pusType[0], pusType[1], pEaOp2->fpFEA2List->list[0].cbValue, *pszSymlink); 1054 1067 rcRet = -EFTYPE; 1055 1068 break;
Note:
See TracChangeset
for help on using the changeset viewer.