loader.c (55b1c6e7e4a6909004e13c6d2f328f911a8e7b83) | loader.c (2ef9ff7dd34a78a7890ba4d6de64da34d9c10942) |
---|---|
1/*- 2 * Copyright (c) 2000 Daniel Capo Sobral 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 488 unchanged lines hidden (view full) --- 497 498 /* ensure that the string is null terminated */ 499 name = (char *)malloc(count+1); 500 bcopy(ptr,name,count); 501 name[count] = 0; 502 503 /* open the file */ 504 fd = open(name, mode); | 1/*- 2 * Copyright (c) 2000 Daniel Capo Sobral 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 488 unchanged lines hidden (view full) --- 497 498 /* ensure that the string is null terminated */ 499 name = (char *)malloc(count+1); 500 bcopy(ptr,name,count); 501 name[count] = 0; 502 503 /* open the file */ 504 fd = open(name, mode); |
505#ifdef LOADER_VERIEXEC 506 if (fd >= 0) { 507 if (verify_file(fd, name, 0, VE_GUESS) < 0) { 508 /* not verified writing ok but reading is not */ 509 if ((mode & O_ACCMODE) != O_WRONLY) { 510 close(fd); 511 fd = -1; 512 } 513 } else { 514 /* verified reading ok but writing is not */ 515 if ((mode & O_ACCMODE) != O_RDONLY) { 516 close(fd); 517 fd = -1; 518 } 519 } 520 } 521#endif |
|
505 free(name); 506 stackPushINT(pVM->pStack, fd); 507 return; 508} 509 510/* fclose - close a file who's fd is on stack. 511 * 512 * fclose ( fd -- ) --- 327 unchanged lines hidden --- | 522 free(name); 523 stackPushINT(pVM->pStack, fd); 524 return; 525} 526 527/* fclose - close a file who's fd is on stack. 528 * 529 * fclose ( fd -- ) --- 327 unchanged lines hidden --- |