diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-05-31 22:16:38 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-05-31 22:16:38 +0000 |
commit | fad2b86c9e7eaadb973b50a1bc0e2accc1a96cfd (patch) | |
tree | f2d3fe127fb6c3c1d3b919631de6e6ed7cbc1791 /applets | |
parent | c2f011aa031b8598422953d5e9a93ca008ad0867 (diff) | |
download | busybox-fad2b86c9e7eaadb973b50a1bc0e2accc1a96cfd.tar.gz |
use "glibc errno" trick not only for ash, but for entire busybox
(add/remove: 1/1 grow/shrink: 37/37 up/down: 139/-228) Total: -89 bytes
Diffstat (limited to 'applets')
-rw-r--r-- | applets/applets.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/applets/applets.c b/applets/applets.c index e905ebec4..bd3704394 100644 --- a/applets/applets.c +++ b/applets/applets.c @@ -641,10 +641,19 @@ void run_applet_and_exit(const char *name, char **argv) } +#ifdef __GLIBC__ +/* Make it reside in R/W memory: */ +int *const bb_errno __attribute__ ((section (".data"))); +#endif + int main(int argc, char **argv) { const char *s; +#ifdef __GLIBC__ + (*(int **)&bb_errno) = __errno_location(); +#endif + #if !BB_MMU /* NOMMU re-exec trick sets high-order bit in first byte of name */ if (argv[0][0] & 0x80) { |