summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2025-05-01 21:29:49 -0700
committerKaz Kylheku <kaz@kylheku.com>2025-05-01 21:29:49 -0700
commit1ec547337765260aa05536e6c5002cb69648af32 (patch)
tree1aa9e8ed39d8eea8a6a11fcaeccbb264d0894742
parent926875f3d3dc79001ecfd84290da8e498d45df05 (diff)
downloadtxr-1ec547337765260aa05536e6c5002cb69648af32.tar.gz
txr-1ec547337765260aa05536e6c5002cb69648af32.tar.bz2
txr-1ec547337765260aa05536e6c5002cb69648af32.zip
sysif: check setenv for error.
* sysif.c (setenv_wrap): Throw an error if setenv returns negative, rather than sweeping the error under the carpet and adding the variable to our hash.
-rw-r--r--sysif.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sysif.c b/sysif.c
index 0ae1030d..481a47ff 100644
--- a/sysif.c
+++ b/sysif.c
@@ -1511,7 +1511,10 @@ static val setenv_wrap(val name, val value, val overwrite)
char *nameu8 = utf8_dup_to(wname);
char *valu8 = wvalu ? utf8_dup_to(wvalu) : 0;
if (valu8) {
- setenv(nameu8, valu8, ovw);
+ if (setenv(nameu8, valu8, ovw) < 0)
+ uw_ethrowf(system_error_s, lit("~a: setenv failed: ~d/~s"),
+ self, num(errno), errno_to_str(errno), nao);
+
env_list = nil;
if (env_hash) {