about summary refs log tree commit diff homepage
path: root/test/Runtime
diff options
context:
space:
mode:
Diffstat (limited to 'test/Runtime')
-rw-r--r--test/Runtime/POSIX/GetcwdFail.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/Runtime/POSIX/GetcwdFail.c b/test/Runtime/POSIX/GetcwdFail.c
new file mode 100644
index 00000000..3482d686
--- /dev/null
+++ b/test/Runtime/POSIX/GetcwdFail.c
@@ -0,0 +1,16 @@
+// RUN: %clang %s -emit-llvm %O0opt -c -o %t.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --libc=klee --posix-runtime %t.bc
+
+#include <assert.h>
+#include <errno.h>
+#include <unistd.h>
+
+int main(void) {
+  // non-null path with 0 size should set EINVAL and return NULL
+  char *path[42];
+  errno = 0;
+  char *result = getcwd(path, 0);
+  assert(errno == EINVAL);
+  assert(result == NULL);
+}