Commit 629b623
committed
generate: replace duplicate env entries
If a given environment variable has already been set, replace the
variable rather than appending it to the environment list. This avoids
issues with POSIX (which doesn't define what to do with duplicate
values).
This required a change in the signature of AddProcessEnv, because doing
the check by splitting around "=" is just not safe (and brings up
questions about variables without "=" in their names that I'd rather
punt on). The check if two variables is the same is if they have the
same NAME= prefix.
Signed-off-by: Aleksa Sarai <asarai@suse.de>1 parent 308b6d9 commit 629b623
2 files changed
Lines changed: 32 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
211 | | - | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
212 | 216 | | |
213 | 217 | | |
214 | 218 | | |
| |||
740 | 744 | | |
741 | 745 | | |
742 | 746 | | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
743 | 763 | | |
744 | 764 | | |
745 | 765 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
331 | 331 | | |
332 | 332 | | |
333 | 333 | | |
334 | | - | |
335 | | - | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
336 | 337 | | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
337 | 346 | | |
338 | 347 | | |
339 | 348 | | |
| |||
0 commit comments