]>
git.saurik.com Git - apple/security.git/blob - SecurityTests/cspxutils/genErrorStrings/fileIo.c
12 const unsigned char *bytes
,
18 fd
= open(fileName
, O_RDWR
| O_CREAT
| O_TRUNC
, 0600);
22 rtn
= lseek(fd
, 0, SEEK_SET
);
26 rtn
= write(fd
, bytes
, (size_t)numBytes
);
27 if(rtn
!= (int)numBytes
) {
29 printf("writeFile: short write\n");
45 unsigned char **bytes
, // mallocd and returned
46 unsigned *numBytes
) // returned
56 fd
= open(fileName
, O_RDONLY
, 0);
65 buf
= (char *)malloc(size
);
70 rtn
= lseek(fd
, 0, SEEK_SET
);
74 rtn
= read(fd
, buf
, (size_t)size
);
75 if(rtn
!= (int)size
) {
77 printf("readFile: short read\n");
83 *bytes
= (unsigned char *)buf
;