diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2016-04-15 06:55:43 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2016-04-15 06:55:43 -0700 |
commit | 50b5651649f71c7f1e4c480504b61cea04d8f789 (patch) | |
tree | 0daa692deb171f219c9f6fde3482b6893ecbd222 /glob.c | |
parent | bc9ba2ccd70756b9c2c006bf8a357b38d198aee2 (diff) | |
download | txr-50b5651649f71c7f1e4c480504b61cea04d8f789.tar.gz txr-50b5651649f71c7f1e4c480504b61cea04d8f789.tar.bz2 txr-50b5651649f71c7f1e4c480504b61cea04d8f789.zip |
glob bugfix: always clear callback global.
* glob.c (glob_wrap): Move c_num call outside of the
section of code where s_errfunc is assigned. We don't
want to do anything here which throws, because then
control escapes without evaluating "s_errfunc = nil",
possibly leaving s_errfunc with a non-nil value
that blocks further uses of glob.
Diffstat (limited to 'glob.c')
-rw-r--r-- | glob.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -68,6 +68,7 @@ val glob_wrap(val pattern, val flags, val errfunc) { char *pat_u8 = utf8_dup_to(c_str(pattern)); glob_t gl; + cnum c_flags = c_num(default_arg(flags, zero)); if (s_errfunc) { free(pat_u8); @@ -77,8 +78,7 @@ val glob_wrap(val pattern, val flags, val errfunc) s_errfunc = default_bool_arg(errfunc); - (void) glob(pat_u8, c_num(default_arg(flags, zero)), - s_errfunc ? errfunc_thunk : 0, &gl); + (void) glob(pat_u8, c_flags, s_errfunc ? errfunc_thunk : 0, &gl); s_errfunc = nil; free(pat_u8); |