fsync.c 438 B

1234567891011121314151617181920
  1. #include <unistd.h>
  2. #include <fcntl.h>
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include "test_helpers.h"
  6. int main(void) {
  7. int fd = open("example_dir/1-never-gonna-give-you-up", O_RDWR);
  8. ERROR_IF(open, fd, == -1);
  9. UNEXP_IF(open, fd, < 0);
  10. int status = fsync(fd);
  11. ERROR_IF(fsync, status, == -1);
  12. UNEXP_IF(fsync, status, != 0);
  13. int c = close(fd);
  14. ERROR_IF(close, c, == -1);
  15. UNEXP_IF(close, c, != 0);
  16. }