From: Markos Chandras <[email protected]>

Signed-off-by: Markos Chandras <[email protected]>
---
 include/unistd.h                       | 1 +
 libc/sysdeps/linux/common/truncate.c   | 9 +++++++++
 libc/sysdeps/linux/common/truncate64.c | 2 +-
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/include/unistd.h b/include/unistd.h
index 7f4db6d..8151726 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -1044,6 +1044,7 @@ extern int __REDIRECT_NTH (truncate,
 # ifdef __USE_LARGEFILE64
 extern int truncate64 (__const char *__file, __off64_t __length)
      __THROW __nonnull ((1)) __wur;
+libc_hidden_proto(truncate64)
 # endif
 
 #endif /* Use BSD || X/Open Unix.  */
diff --git a/libc/sysdeps/linux/common/truncate.c 
b/libc/sysdeps/linux/common/truncate.c
index 2331bdd..cbdd3bd 100644
--- a/libc/sysdeps/linux/common/truncate.c
+++ b/libc/sysdeps/linux/common/truncate.c
@@ -11,5 +11,14 @@
 #include <unistd.h>
 
 
+#if defined(__NR_truncate64) && !defined(__NR_truncate)
+int truncate(const char *path, __off_t length)
+{
+       return truncate64(path, length);
+}
+libc_hidden_def(truncate);
+
+#else
 _syscall2(int, truncate, const char *, path, __off_t, length)
 libc_hidden_def(truncate)
+#endif
diff --git a/libc/sysdeps/linux/common/truncate64.c 
b/libc/sysdeps/linux/common/truncate64.c
index 1f6c459..f0bb4b1 100644
--- a/libc/sysdeps/linux/common/truncate64.c
+++ b/libc/sysdeps/linux/common/truncate64.c
@@ -64,5 +64,5 @@ int truncate64(const char * path, __off64_t length)
 }
 
 #endif /* __NR_truncate64 */
-
+libc_hidden_def(truncate64)
 #endif /* __UCLIBC_HAS_LFS__ */
-- 
1.8.0


_______________________________________________
uClibc mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/uclibc

Reply via email to