about summary refs log tree commit diff homepage
path: root/test/Runtime/POSIX/Fcntl.c
blob: 139fb1f3ed1ee5a1f876103fafc92f6ed2e86001 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t2.bc
// RUN: %klee --init-env --posix-runtime --exit-on-error %t2.bc --sym-files 1 10

#include <assert.h>
#include <fcntl.h>

int main(int argc, char **argv) {
  int fd = open("A", O_RDWR|O_TRUNC);
  if (fd == -1)
    klee_silent_exit(0);
  assert(fd == 3);
  assert((fcntl(fd, F_GETFD) & FD_CLOEXEC) == 0);
  assert(fcntl(fd, F_SETFD, FD_CLOEXEC, 1) == 0);
  assert((fcntl(fd, F_GETFD) & FD_CLOEXEC) != 0);

  return 0;
}