summaryrefslogtreecommitdiffstats
path: root/usr/klibc/getcwd.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr/klibc/getcwd.c')
-rw-r--r--usr/klibc/getcwd.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/usr/klibc/getcwd.c b/usr/klibc/getcwd.c
new file mode 100644
index 0000000..22ec812
--- /dev/null
+++ b/usr/klibc/getcwd.c
@@ -0,0 +1,15 @@
+/*
+ * getcwd.c
+ *
+ * The system call behaves differently than the library function.
+ */
+
+#include <unistd.h>
+#include <sys/syscall.h>
+
+extern int __getcwd(char *buf, size_t size);
+
+char *getcwd(char *buf, size_t size)
+{
+ return (__getcwd(buf, size) < 0) ? NULL : buf;
+}