Changeset 3914
- Timestamp:
- Oct 24, 2014, 4:01:38 PM (11 years ago)
- Files:
-
- 7 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/libc-0.6/src/emx/include/InnoTekLIBC/backend.h
r3859 r3914 189 189 /** Get the native path instead, no unix root translations. */ 190 190 #define __LIBC_BACKFS_FLAGS_RESOLVE_NATIVE 0x10 191 /** Direct buffer mode for testing purposes. */ 192 #define __LIBC_BACKFS_FLAGS_RESOLVE_DIRECT_BUF 0x8000 191 193 /** @} */ 192 194 -
branches/libc-0.6/src/emx/src/lib/sys/b_fsPathResolve.c
r3771 r3914 65 65 */ 66 66 int fInUnixTree = 0; 67 char szNativePath[PATH_MAX];68 67 unsigned int fBackFsFlags = fFlags & __LIBC_BACKFS_FLAGS_RESOLVE_FULL_MAYBE 69 68 ? BACKFS_FLAGS_RESOLVE_DIR_MAYBE | BACKFS_FLAGS_RESOLVE_FULL_MAYBE 70 69 : BACKFS_FLAGS_RESOLVE_DIR_MAYBE | BACKFS_FLAGS_RESOLVE_FULL; 71 szNativePath[0] = szNativePath[1] = szNativePath[2] = szNativePath[3] = '\0'; 72 rc = __libc_back_fsResolve(pszPath, fBackFsFlags, szNativePath, &fInUnixTree); 70 if (!(fFlags & __LIBC_BACKFS_FLAGS_RESOLVE_DIRECT_BUF)) 71 { 72 char szNativePath[PATH_MAX]; 73 szNativePath[0] = szNativePath[1] = szNativePath[2] = szNativePath[3] = '\0'; 74 rc = __libc_back_fsResolve(pszPath, fBackFsFlags, szNativePath, &fInUnixTree); 73 75 74 /* 75 * Copy the (half) result back to the caller. 76 */ 77 char *pszSrc = &szNativePath[0]; 78 if ( !(fFlags & __LIBC_BACKFS_FLAGS_RESOLVE_NATIVE) 79 && fInUnixTree 80 && *pszSrc) 76 /* 77 * Copy the (half) result back to the caller. 78 */ 79 char *pszSrc = &szNativePath[0]; 80 if ( !(fFlags & __LIBC_BACKFS_FLAGS_RESOLVE_NATIVE) 81 && fInUnixTree 82 && *pszSrc) 83 { 84 pszSrc += __libc_gcchUnixRoot; 85 LIBC_ASSERTM(*pszSrc == '/', "bogus fInUnixTree flag! pszSrc='%s' whole thing is '%s'\n", pszSrc, szNativePath); 86 } 87 __libc_back_fsMutexRelease(); 88 89 int cch = strlen(pszSrc) + 1; 90 if (cch < cchBuf) 91 memcpy(pszBuf, pszSrc, cchBuf); 92 else if (!rc) 93 rc = -ERANGE; 94 } 95 else 81 96 { 82 pszSrc += __libc_gcchUnixRoot; 83 LIBC_ASSERTM(*pszSrc == '/', "bogus fInUnixTree flag! pszSrc='%s' whole thing is '%s'\n", pszSrc, szNativePath); 97 /* 98 * Special case for testing purposes only. 99 */ 100 if (cchBuf >= PATH_MAX) 101 { 102 rc = __libc_back_fsResolve(pszPath, fBackFsFlags, pszBuf, &fInUnixTree); 103 if ( !(fFlags & __LIBC_BACKFS_FLAGS_RESOLVE_NATIVE) 104 && fInUnixTree 105 && pszBuf) 106 { 107 memmove(pszBuf, pszBuf + __libc_gcchUnixRoot, strlen(pszBuf) - __libc_gcchUnixRoot + 1); 108 LIBC_ASSERTM(*pszBuf== '/', "bogus fInUnixTree flag! pszBuf='%s'\n", pszBuf); 109 } 110 } 111 else 112 rc = EINVAL; 113 114 __libc_back_fsMutexRelease(); 84 115 } 85 __libc_back_fsMutexRelease();86 87 int cch = strlen(pszSrc) + 1;88 if (cch < cchBuf)89 memcpy(pszBuf, pszSrc, cchBuf);90 else if (!rc)91 rc = -ERANGE;92 116 93 117 if (!rc) -
branches/libc-0.6/src/emx/src/lib/sys/fs.c
r3912 r3914 1013 1013 { 1014 1014 if ((uintptr_t)(pszUserPath - pachBuffer) > SIZEOF_ACHBUFFER) 1015 pszUserPath = strcpy(pachBuffer, pszUserPath); 1015 { 1016 size_t cbUserPath = strlen(pszUserPath) + 1; 1017 if (cbUserPath > PATH_MAX) 1018 { 1019 rcRet = -ENAMETOOLONG; 1020 break; 1021 } 1022 pszUserPath = memcpy(pachBuffer, pszUserPath, cbUserPath); 1023 } 1016 1024 *(char *)(void *)pszUserPath += 'A' - 'a'; 1017 1025 } -
trunk/libc/include/klibc/backend.h
r3897 r3914 265 265 /** Get the native path instead, no unix root translations. */ 266 266 #define __LIBC_BACKFS_FLAGS_RESOLVE_NATIVE 0x10 267 /** Direct buffer mode for testing purposes. */ 268 #define __LIBC_BACKFS_FLAGS_RESOLVE_DIRECT_BUF 0x8000 267 269 /** @} */ 268 270 -
trunk/libc/src/kNIX/b_fsPathResolve.c
r3863 r3914 53 53 */ 54 54 int fInUnixTree = 0; 55 char szNativePath[PATH_MAX];56 55 unsigned int fBackFsFlags = fFlags & __LIBC_BACKFS_FLAGS_RESOLVE_FULL_MAYBE 57 56 ? BACKFS_FLAGS_RESOLVE_DIR_MAYBE | BACKFS_FLAGS_RESOLVE_FULL_MAYBE 58 57 : BACKFS_FLAGS_RESOLVE_DIR_MAYBE | BACKFS_FLAGS_RESOLVE_FULL; 59 szNativePath[0] = szNativePath[1] = szNativePath[2] = szNativePath[3] = '\0'; 60 rc = __libc_back_fsResolve(pszPath, fBackFsFlags, szNativePath, &fInUnixTree); 58 if (!(fFlags & __LIBC_BACKFS_FLAGS_RESOLVE_DIRECT_BUF)) 59 { 60 char szNativePath[PATH_MAX]; 61 szNativePath[0] = szNativePath[1] = szNativePath[2] = szNativePath[3] = '\0'; 62 rc = __libc_back_fsResolve(pszPath, fBackFsFlags, szNativePath, &fInUnixTree); 61 63 62 /* 63 * Copy the (half) result back to the caller. 64 */ 65 char *pszSrc = &szNativePath[0]; 66 if ( !(fFlags & __LIBC_BACKFS_FLAGS_RESOLVE_NATIVE) 67 && fInUnixTree 68 && *pszSrc) 64 /* 65 * Copy the (half) result back to the caller. 66 */ 67 char *pszSrc = &szNativePath[0]; 68 if ( !(fFlags & __LIBC_BACKFS_FLAGS_RESOLVE_NATIVE) 69 && fInUnixTree 70 && *pszSrc) 71 { 72 pszSrc += __libc_gcchUnixRoot; 73 LIBC_ASSERTM(*pszSrc == '/', "bogus fInUnixTree flag! pszSrc='%s' whole thing is '%s'\n", pszSrc, szNativePath); 74 } 75 __libc_back_fsMutexRelease(); 76 77 int cch = strlen(pszSrc) + 1; 78 if (cch < cchBuf) 79 memcpy(pszBuf, pszSrc, cchBuf); 80 else if (!rc) 81 rc = -ERANGE; 82 } 83 else 69 84 { 70 pszSrc += __libc_gcchUnixRoot; 71 LIBC_ASSERTM(*pszSrc == '/', "bogus fInUnixTree flag! pszSrc='%s' whole thing is '%s'\n", pszSrc, szNativePath); 72 } 73 __libc_back_fsMutexRelease(); 85 /* 86 * Special case for testing purposes only. 87 */ 88 if (cchBuf >= PATH_MAX) 89 { 90 rc = __libc_back_fsResolve(pszPath, fBackFsFlags, pszBuf, &fInUnixTree); 91 if ( !(fFlags & __LIBC_BACKFS_FLAGS_RESOLVE_NATIVE) 92 && fInUnixTree 93 && pszBuf) 94 { 95 memmove(pszBuf, pszBuf + __libc_gcchUnixRoot, strlen(pszBuf) - __libc_gcchUnixRoot + 1); 96 LIBC_ASSERTM(*pszBuf== '/', "bogus fInUnixTree flag! pszBuf='%s'\n", pszBuf); 97 } 98 } 99 else 100 rc = EINVAL; 74 101 75 int cch = strlen(pszSrc) + 1; 76 if (cch < cchBuf) 77 memcpy(pszBuf, pszSrc, cchBuf); 78 else if (!rc) 79 rc = -ERANGE; 102 __libc_back_fsMutexRelease(); 103 } 80 104 81 105 if (!rc) -
trunk/libc/src/kNIX/os2/fs-os2.c
r3912 r3914 978 978 { 979 979 if ((uintptr_t)(pszUserPath - pachBuffer) > SIZEOF_ACHBUFFER) 980 pszUserPath = strcpy(pachBuffer, pszUserPath); 980 { 981 size_t cbUserPath = strlen(pszUserPath) + 1; 982 if (cbUserPath > PATH_MAX) 983 { 984 rcRet = -ENAMETOOLONG; 985 break; 986 } 987 pszUserPath = memcpy(pachBuffer, pszUserPath, cbUserPath); 988 } 981 989 *(char *)(void *)pszUserPath += 'A' - 'a'; 982 990 } -
trunk/libc/tests/libc/Makefile
r3813 r3914 158 158 io/sprintf-1.c \ 159 159 io/sscanf-1.c \ 160 io/pathresolving-1.c 160 io/pathresolving-1.c \ 161 io/pathresolving-2.c 161 162 162 163
Note:
See TracChangeset
for help on using the changeset viewer.