Root/package/busybox/patches/250-ash_export-n.patch

1--- a/shell/ash.c
2+++ b/shell/ash.c
3@@ -12351,8 +12351,17 @@ exportcmd(int argc UNUSED_PARAM, char **
4     const char *p;
5     char **aptr;
6     int flag = argv[0][0] == 'r' ? VREADONLY : VEXPORT;
7+ int mask = ~0;
8+ int nopt;
9+ while ((nopt = nextopt("np"))) {
10+ if (nopt == 'n') {
11+ mask = ~flag;
12+ } else { /* p */
13+ break;
14+ }
15+ }
16 
17- if (nextopt("p") != 'p') {
18+ if (nopt != 'p') {
19         aptr = argptr;
20         name = *aptr;
21         if (name) {
22@@ -12364,10 +12373,12 @@ exportcmd(int argc UNUSED_PARAM, char **
23                     vp = *findvar(hashvar(name), name);
24                     if (vp) {
25                         vp->flags |= flag;
26+ vp->flags &= mask;
27                         continue;
28                     }
29                 }
30                 setvar(name, p, flag);
31+ setvar(name, p, flag & mask);
32             } while ((name = *++aptr) != NULL);
33             return 0;
34         }
35

Archive Download this file



interactive