Lines Matching refs:fd
312 int fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_SYNC, S_IRUSR | S_IWUSR); in SaveFileContents() local
313 if (fd < 0) { in SaveFileContents()
319 ssize_t bytes_written = FileSink(file->data, file->size, &fd); in SaveFileContents()
324 close(fd); in SaveFileContents()
327 if (fsync(fd) != 0) { in SaveFileContents()
331 if (close(fd) != 0) { in SaveFileContents()
417 int fd = open(partition, O_RDWR | O_SYNC); in WriteToPartition() local
418 if (fd < 0) { in WriteToPartition()
425 if (TEMP_FAILURE_RETRY(lseek(fd, start, SEEK_SET)) == -1) { in WriteToPartition()
434 ssize_t written = TEMP_FAILURE_RETRY(write(fd, data+start, to_write)); in WriteToPartition()
441 if (fsync(fd) != 0) { in WriteToPartition()
446 if (close(fd) != 0) { in WriteToPartition()
451 fd = open(partition, O_RDONLY); in WriteToPartition()
452 if (fd < 0) { in WriteToPartition()
471 if (TEMP_FAILURE_RETRY(lseek(fd, 0, SEEK_SET)) == -1) { in WriteToPartition()
486 TEMP_FAILURE_RETRY(read(fd, buffer+so_far, to_read-so_far)); in WriteToPartition()
518 if (close(fd) != 0) { in WriteToPartition()
627 int fd = *(int *)token; in FileSink() local
631 wrote = TEMP_FAILURE_RETRY(write(fd, data+done, len-done)); in FileSink()