diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2025-05-01 21:29:49 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2025-05-01 21:29:49 -0700 |
commit | 1ec547337765260aa05536e6c5002cb69648af32 (patch) | |
tree | 1aa9e8ed39d8eea8a6a11fcaeccbb264d0894742 | |
parent | 926875f3d3dc79001ecfd84290da8e498d45df05 (diff) | |
download | txr-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.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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) { |