Changeset 3192 for trunk/src/kmk/kmkbuiltin/kbuild_protection.c
- Timestamp:
- Mar 26, 2018, 10:25:56 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/kmkbuiltin/kbuild_protection.c
r2413 r3192 116 116 * On failure an error is printed, eval is set and -1 is returned. 117 117 */ 118 static int countPathComponents( const char *pszPath)118 static int countPathComponents(PCKBUILDPROTECTION pThis, const char *pszPath) 119 119 { 120 120 int cComponents = 0; … … 158 158 if (!pszTmp) 159 159 { 160 err( 1, "_getdcwd");160 err(pThis->pCtx, 1, "_getdcwd"); 161 161 return -1; 162 162 } … … 196 196 if (!getcwd(szCwd, sizeof(szCwd))) 197 197 { 198 err( 1, "getcwd");198 err(pThis->pCtx, 1, "getcwd"); 199 199 return -1; 200 200 } … … 217 217 * @param pThis Pointer to the instance data. 218 218 */ 219 void kBuildProtectionInit(PKBUILDPROTECTION pThis )219 void kBuildProtectionInit(PKBUILDPROTECTION pThis, PKMKBUILTINCTX pCtx) 220 220 { 221 221 pThis->uMagic = KBUILD_PROTECTION_MAGIC; 222 pThis->pCtx = pCtx; 222 223 pThis->afTypes[KBUILDPROTECTIONTYPE_FULL] = 0; 223 224 pThis->afTypes[KBUILDPROTECTIONTYPE_RECURSIVE] = 1; … … 268 269 /* number or path? */ 269 270 if (!isdigit(*pszValue) || strpbrk(pszValue, ":/\\")) 270 pThis->cProtectionDepth = countPathComponents(p szValue);271 pThis->cProtectionDepth = countPathComponents(pThis, pszValue); 271 272 else 272 273 { … … 280 281 } 281 282 if (!pThis->cProtectionDepth || pszValue == pszMore || *pszMore) 282 return errx( 1, "bogus protection depth: %s", pszValue);283 return errx(pThis->pCtx, 1, "bogus protection depth: %s", pszValue); 283 284 } 284 285 285 286 if (pThis->cProtectionDepth < 1) 286 return errx( 1, "bogus protection depth: %s", pszValue);287 return errx(pThis->pCtx, 1, "bogus protection depth: %s", pszValue); 287 288 return 0; 288 289 } … … 351 352 * Count the path and compare it with the required depth. 352 353 */ 353 int cComponents = countPathComponents(p szPath);354 int cComponents = countPathComponents(pThis, pszPath); 354 355 if (cComponents < 0) 355 356 return -1; 356 357 if ((unsigned int)cComponents <= pThis->cProtectionDepth) 357 358 { 358 errx( 1, "%s: protected", pszPath);359 errx(pThis->pCtx, 1, "%s: protected", pszPath); 359 360 return -1; 360 361 }
Note:
See TracChangeset
for help on using the changeset viewer.