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
This commit is contained in:
Denis Vlasenko 2007-05-31 22:16:38 +00:00
parent c2f011aa03
commit fad2b86c9e
16 changed files with 23 additions and 83 deletions

View file

@ -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) {