You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
629 B

  1. /* -*- mode: C; c-basic-offset: 4 -*- */
  2. #ident "Copyright (c) 2007 Tokutek Inc. All rights reserved."
  3. #include <assert.h>
  4. #include <errno.h>
  5. #include <fcntl.h>
  6. #include <stdlib.h>
  7. #include <stdio.h>
  8. #include <string.h>
  9. #include <sys/stat.h>
  10. #include <sys/types.h>
  11. #include <unistd.h>
  12. #define fname __FILE__ ".tmp"
  13. int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__unused__))) {
  14. unlink(fname);
  15. int fd0 = open (fname, O_RDWR|O_CREAT|O_EXCL, 0777);
  16. assert(fd0>=0);
  17. int fd1 = open (fname, O_RDWR|O_CREAT|O_EXCL, 0777);
  18. assert(fd1==-1);
  19. assert(errno==EEXIST);
  20. return 0;
  21. }