aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2021-09-05 16:22:45 +0100
committerRon Yorston <rmy@pobox.com>2021-09-05 16:22:45 +0100
commit462863e747da49d4feefb08f8fb81292a9ab722e (patch)
tree86b384180442ce9f22a670c66880bc2e0239a8f4
parentf67224cb2f60288c731b94975e20bd922eaacf6c (diff)
downloadbusybox-w32-462863e747da49d4feefb08f8fb81292a9ab722e.tar.gz
busybox-w32-462863e747da49d4feefb08f8fb81292a9ab722e.tar.bz2
busybox-w32-462863e747da49d4feefb08f8fb81292a9ab722e.zip
ash: code shrink
Tweak the code to handle /etc/profile. Looks tidier and saves 8 bytes.
-rw-r--r--shell/ash.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/shell/ash.c b/shell/ash.c
index ff2a54fbe..faf861583 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -15542,9 +15542,8 @@ int ash_main(int argc UNUSED_PARAM, char **argv)
15542 struct jmploc jmploc; 15542 struct jmploc jmploc;
15543 struct stackmark smark; 15543 struct stackmark smark;
15544 int login_sh; 15544 int login_sh;
15545#if ENABLE_PLATFORM_MINGW32
15546 const char *sd;
15547 15545
15546#if ENABLE_PLATFORM_MINGW32
15548 INIT_G_memstack(); 15547 INIT_G_memstack();
15549 15548
15550 /* from init() */ 15549 /* from init() */
@@ -15660,15 +15659,12 @@ int ash_main(int argc UNUSED_PARAM, char **argv)
15660 15659
15661 state = 1; 15660 state = 1;
15662#if ENABLE_PLATFORM_MINGW32 15661#if ENABLE_PLATFORM_MINGW32
15663 sd = get_system_drive(); 15662 hp = xasprintf("%s/etc/profile", get_system_drive() ?: "");
15664 if (sd) { 15663 read_profile(hp);
15665 char *path = xasprintf("%s/etc/profile", sd); 15664 free((void *)hp);
15666 read_profile(path); 15665#else
15667 free(path);
15668 }
15669 else
15670#endif
15671 read_profile("/etc/profile"); 15666 read_profile("/etc/profile");
15667#endif
15672 state1: 15668 state1:
15673 state = 2; 15669 state = 2;
15674 hp = lookupvar("HOME"); 15670 hp = lookupvar("HOME");