ash: in bash compat mode, always export $SHLVL
authorDenys Vlasenko <vda.linux@googlemail.com>
Tue, 7 Jan 2014 15:12:48 +0000 (16:12 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Tue, 7 Jan 2014 15:12:48 +0000 (16:12 +0100)
function                                             old     new   delta
ash_main                                            1437    1442      +5

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
shell/ash.c

index 71ef9a690f5941f567e35b7c911b7a248fde45d4..04ba447b1f2a9d7e8320389bcaff210d49c4e9f3 100644 (file)
@@ -13014,7 +13014,7 @@ init(void)
                setvar2("PPID", utoa(getppid()));
 #if ENABLE_ASH_BASH_COMPAT
                p = lookupvar("SHLVL");
-               setvar2("SHLVL", utoa(p ? atoi(p) + 1 : 1));
+               setvar("SHLVL", utoa((p ? atoi(p) : 0) + 1), VEXPORT);
 #endif
                p = lookupvar("PWD");
                if (p) {