refresh busybox patches
[openwrt/openwrt.git] / package / busybox / patches / 250-ash_export-n.patch
1 Index: busybox-1.7.2/shell/ash.c
2 ===================================================================
3 --- busybox-1.7.2.orig/shell/ash.c 2007-10-30 15:34:59.000000000 -0500
4 +++ busybox-1.7.2/shell/ash.c 2007-10-30 15:35:02.000000000 -0500
5 @@ -11310,8 +11310,18 @@
6 const char *p;
7 char **aptr;
8 int flag = argv[0][0] == 'r'? VREADONLY : VEXPORT;
9 + int mask = ~0;
10 + int nopt;
11
12 - if (nextopt("p") != 'p') {
13 + while ((nopt = nextopt("np"))) {
14 + if (nopt == 'n') {
15 + mask = ~flag;
16 + } else { /* p */
17 + break;
18 + }
19 + }
20 +
21 + if (nopt != 'p') {
22 aptr = argptr;
23 name = *aptr;
24 if (name) {
25 @@ -11323,10 +11333,11 @@
26 vp = *findvar(hashvar(name), name);
27 if (vp) {
28 vp->flags |= flag;
29 + vp->flags &= mask;
30 continue;
31 }
32 }
33 - setvar(name, p, flag);
34 + setvar(name, p, flag & mask);
35 } while ((name = *++aptr) != NULL);
36 return 0;
37 }