summaryrefslogtreecommitdiffstats
path: root/libc/sysdeps/linux/common
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps/linux/common')
-rw-r--r--libc/sysdeps/linux/common/getcwd.c11
-rw-r--r--libc/sysdeps/linux/common/iopl.c11
2 files changed, 14 insertions, 8 deletions
diff --git a/libc/sysdeps/linux/common/getcwd.c b/libc/sysdeps/linux/common/getcwd.c
index daf056e98..a1de4510c 100644
--- a/libc/sysdeps/linux/common/getcwd.c
+++ b/libc/sysdeps/linux/common/getcwd.c
@@ -10,7 +10,7 @@
#ifdef __NR_getcwd
#define __NR___syscall_getcwd __NR_getcwd
-static inline
+static inline
_syscall2(int, __syscall_getcwd, char *, buf, unsigned long, size);
#else
@@ -134,6 +134,15 @@ int __syscall_getcwd(char * buf, unsigned long size)
olderrno = errno;
len = -1;
+
+ /* get stat for root to have a valid parameters for the terminating condition */
+ if (stat("/", &st) < 0) {
+ /* root dir not found! */
+ return -1;
+ }
+ /* start with actual dir */
+ if (buf) strncpy(buf, ".", size);
+
cwd = recurser(buf, size, st.st_dev, st.st_ino);
if (cwd) {
len = strlen(buf);
diff --git a/libc/sysdeps/linux/common/iopl.c b/libc/sysdeps/linux/common/iopl.c
index 9e507bebc..dd45563c2 100644
--- a/libc/sysdeps/linux/common/iopl.c
+++ b/libc/sysdeps/linux/common/iopl.c
@@ -2,22 +2,19 @@
/*
* iopl() for uClibc
*
- * Copyright (C) 2000-2004 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 2000-2005 by Erik Andersen <andersen@codepoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
-/* For arm there is a totally different implementation */
-#if !defined(__arm__)
/* Tuns out the m68k unistd.h kernel header is broken */
-# if defined __ARCH_HAS_MMU__ && defined __NR_iopl && ( !defined(__mc68000__))
+#if defined __ARCH_HAS_MMU__ && defined __NR_iopl && ( !defined(__mc68000__))
_syscall1(int, iopl, int, level);
-# else
+#else
int iopl(int level)
{
__set_errno(ENOSYS);
return -1;
}
-# endif
-# endif
+#endif