int fd;
fd = open(fileName, O_RDWR | O_CREAT | O_TRUNC, 0600);
- if(fd < 0) {
- return errno;
- }
- rtn = (int)lseek(fd, 0, SEEK_SET);
- if(rtn < 0) {
+ if(fd == -1) {
return errno;
}
rtn = (int)write(fd, bytes, (size_t)numBytes);
*numBytes = 0;
*bytes = NULL;
fd = open(fileName, O_RDONLY, 0);
- if(fd < 0) {
+ if(fd == -1) {
return errno;
}
rtn = fstat(fd, &sb);