aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2009-09-07 06:13:45 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2009-09-07 06:13:45 +0000
commit7f00942963777581e9ab167885eeb3b874dc7534 (patch)
treefe9b702b2cdb2793323f1568ebd2a7fbf804b87a
parent813042bf6af6ea4c3e459abcf2b18f4508257384 (diff)
downloadaports-7f00942963777581e9ab167885eeb3b874dc7534.tar.bz2
aports-7f00942963777581e9ab167885eeb3b874dc7534.tar.xz
main/uclibc: backport fix for fstatat()
-rw-r--r--main/uclibc/APKBUILD4
-rw-r--r--main/uclibc/fstatat-fix-32bit.patch102
2 files changed, 105 insertions, 1 deletions
diff --git a/main/uclibc/APKBUILD b/main/uclibc/APKBUILD
index fd6555f124..4210b3e68a 100644
--- a/main/uclibc/APKBUILD
+++ b/main/uclibc/APKBUILD
@@ -1,7 +1,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=uclibc
pkgver=0.9.30.1
-pkgrel=15
+pkgrel=16
pkgdesc="C library for developing embedded Linux systems"
url=http://uclibc.org
license="LGPL-2"
@@ -15,6 +15,7 @@ source="http://uclibc.org/downloads/$_mynamever.tar.bz2
uclibc-0.9.30.1-pthread_getattr_np.patch
0001-ldd-segfault-fix.patch
0001-linuxthreads-fixes-from-Will-Newton-will.newton-AT-g.patch
+ fstatat-fix-32bit.patch
pthread-new-aliasing-fix.diff
uclibc-resolv-cname-fix.diff
uclibc-i386-floating-stacks.diff
@@ -65,6 +66,7 @@ ea91460617601b6e084ead66bc3948f5 uclibc-0.9.30.1-resolv.patch
cf80c0d44a41e02f389be427ee615d61 uclibc-0.9.30.1-pthread_getattr_np.patch
4079b20c763727863bc53408e4988434 0001-ldd-segfault-fix.patch
bcd1c4c9c87f092fb4631559e6ec13ba 0001-linuxthreads-fixes-from-Will-Newton-will.newton-AT-g.patch
+14d9fa172f67fee0257f0441b3b3bc13 fstatat-fix-32bit.patch
969187e1da84d0a0a5957b392a3d5a2b pthread-new-aliasing-fix.diff
bbb8475963e791f596c34c81ef5583d7 uclibc-resolv-cname-fix.diff
0b3966ab7774ac42ecf34a7b596c661b uclibc-i386-floating-stacks.diff
diff --git a/main/uclibc/fstatat-fix-32bit.patch b/main/uclibc/fstatat-fix-32bit.patch
new file mode 100644
index 0000000000..536cd8b624
--- /dev/null
+++ b/main/uclibc/fstatat-fix-32bit.patch
@@ -0,0 +1,102 @@
+From 656167d89112171b2b7672676dc413c676a186f5 Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Sun, 06 Sep 2009 16:12:12 +0000
+Subject: fstatat: fix up behavior on 32/64 bit hosts
+
+The fstatat() syscall is a little funky in that it sometimes changes name
+between 32 and 64 bit hosts, but it should always operate on a 64bit stat
+structure. So for the fstatat() function, make sure we convert it from a
+64bit kstat to a 32bit stat.
+
+Along these lines, we need to restore the __xstat32_conv() function.
+
+Reported-by: Timo Teräs <timo.teras@iki.fi>
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+diff --git a/libc/sysdeps/linux/common/fstatat.c b/libc/sysdeps/linux/common/fstatat.c
+index 149c189..33daa7c 100644
+--- a/libc/sysdeps/linux/common/fstatat.c
++++ b/libc/sysdeps/linux/common/fstatat.c
+@@ -10,15 +10,20 @@
+ #include <sys/stat.h>
+ #include "xstatconv.h"
+
++/* 64bit ports tend to favor newfstatat() */
++#ifdef __NR_newfstatat
++# define __NR_fstatat64 __NR_newfstatat
++#endif
++
+ #ifdef __NR_fstatat64
+ int fstatat(int fd, const char *file, struct stat *buf, int flag)
+ {
+ int ret;
+- struct kernel_stat kbuf;
++ struct kernel_stat64 kbuf;
+
+ ret = INLINE_SYSCALL(fstatat64, 4, fd, file, &kbuf, flag);
+ if (ret == 0)
+- __xstat_conv(&kbuf, buf);
++ __xstat32_conv(&kbuf, buf);
+
+ return ret;
+ }
+diff --git a/libc/sysdeps/linux/common/fstatat64.c b/libc/sysdeps/linux/common/fstatat64.c
+index 5ae1fad..95627af 100644
+--- a/libc/sysdeps/linux/common/fstatat64.c
++++ b/libc/sysdeps/linux/common/fstatat64.c
+@@ -12,6 +12,11 @@
+
+ #ifdef __UCLIBC_HAS_LFS__
+
++/* 64bit ports tend to favor newfstatat() */
++#ifdef __NR_newfstatat
++# define __NR_fstatat64 __NR_newfstatat
++#endif
++
+ #ifdef __NR_fstatat64
+ int fstatat64(int fd, const char *file, struct stat64 *buf, int flag)
+ {
+diff --git a/libc/sysdeps/linux/common/xstatconv.c b/libc/sysdeps/linux/common/xstatconv.c
+index 2a82458..deef392 100644
+--- a/libc/sysdeps/linux/common/xstatconv.c
++++ b/libc/sysdeps/linux/common/xstatconv.c
+@@ -44,6 +44,25 @@ void __xstat_conv(struct kernel_stat *kbuf, struct stat *buf)
+ buf->st_ctim = kbuf->st_ctim;
+ }
+
++void __xstat32_conv(struct kernel_stat64 *kbuf, struct stat *buf)
++{
++ /* Convert to current kernel version of `struct stat64'. */
++ memset(buf, 0x00, sizeof(*buf));
++ buf->st_dev = kbuf->st_dev;
++ buf->st_ino = kbuf->st_ino;
++ buf->st_mode = kbuf->st_mode;
++ buf->st_nlink = kbuf->st_nlink;
++ buf->st_uid = kbuf->st_uid;
++ buf->st_gid = kbuf->st_gid;
++ buf->st_rdev = kbuf->st_rdev;
++ buf->st_size = kbuf->st_size;
++ buf->st_blksize = kbuf->st_blksize;
++ buf->st_blocks = kbuf->st_blocks;
++ buf->st_atime = kbuf->st_atime;
++ buf->st_mtime = kbuf->st_mtime;
++ buf->st_ctime = kbuf->st_ctime;
++}
++
+ #ifdef __UCLIBC_HAS_LFS__
+
+ void __xstat64_conv(struct kernel_stat64 *kbuf, struct stat64 *buf)
+diff --git a/libc/sysdeps/linux/common/xstatconv.h b/libc/sysdeps/linux/common/xstatconv.h
+index 57c8bcb..7568da8 100644
+--- a/libc/sysdeps/linux/common/xstatconv.h
++++ b/libc/sysdeps/linux/common/xstatconv.h
+@@ -26,6 +26,7 @@
+ #include <bits/kernel_stat.h>
+
+ extern void __xstat_conv(struct kernel_stat *kbuf, struct stat *buf) attribute_hidden;
++extern void __xstat32_conv(struct kernel_stat64 *kbuf, struct stat *buf) attribute_hidden;
+ #if defined __UCLIBC_HAS_LFS__
+ extern void __xstat64_conv(struct kernel_stat64 *kbuf, struct stat64 *buf) attribute_hidden;
+ #endif
+--
+cgit v0.8.2.1