aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/unix
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix')
-rw-r--r--sysdeps/unix/sysv/linux/getcwd.c21
-rw-r--r--sysdeps/unix/sysv/linux/net/if.h3
-rw-r--r--sysdeps/unix/sysv/linux/pty.c3
3 files changed, 17 insertions, 10 deletions
diff --git a/sysdeps/unix/sysv/linux/getcwd.c b/sysdeps/unix/sysv/linux/getcwd.c
index 2af3b78..f3406d7 100644
--- a/sysdeps/unix/sysv/linux/getcwd.c
+++ b/sysdeps/unix/sysv/linux/getcwd.c
@@ -69,19 +69,20 @@ __getcwd (char *buf, size_t size)
n = __readlink ("/proc/self/cwd", path, alloc_size - 1);
if (n != -1)
{
- if (n >= alloc_size - 1)
+ if (path[0] == '/')
{
- if (size > 0)
- return NULL;
+ if (n >= alloc_size - 1)
+ {
+ if (buf == NULL)
+ free (path);
+ return NULL;
+ }
+
+ path[n] = '\0';
+ return buf ?: (char *) realloc (path, (size_t) n + 1);
}
else
- if (path[0] == '/')
- {
- path[n] = '\0';
- return buf ?: (char *) realloc (path, (size_t) n + 1);
- }
- else
- no_new_dcache = 1;
+ no_new_dcache = 1;
}
/* Set to no_new_dcache only if error indicates that proc doesn't exist. */
diff --git a/sysdeps/unix/sysv/linux/net/if.h b/sysdeps/unix/sysv/linux/net/if.h
index 861ca26..468fed2 100644
--- a/sysdeps/unix/sysv/linux/net/if.h
+++ b/sysdeps/unix/sysv/linux/net/if.h
@@ -147,6 +147,7 @@ struct ifconf
#define ifc_buf ifc_ifcu.ifcu_buf /* Buffer address. */
#define ifc_req ifc_ifcu.ifcu_req /* Array of structures. */
+__BEGIN_DECLS
/* Convert an interface name to an index, and vice versa. */
@@ -167,4 +168,6 @@ extern struct if_nameindex *if_nameindex __P ((void));
extern void if_freenameindex __P ((struct if_nameindex *__ptr));
+__END_DECLS
+
#endif /* net/if.h */
diff --git a/sysdeps/unix/sysv/linux/pty.c b/sysdeps/unix/sysv/linux/pty.c
new file mode 100644
index 0000000..e64261c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/pty.c
@@ -0,0 +1,3 @@
+/* Linux does not has the `revoke' function. */
+#define REVOKE(Line)
+#include <sysdeps/generic/pty.c>