diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2019-05-16 09:23:20 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2019-05-16 09:23:20 +0300 |
commit | 1fa2dd2c6587822ff682581643499c3c3b78c9ea (patch) | |
tree | 2e7f37a1e27a38687182ab2aad60a994f9e153eb | |
parent | 20899f652a904b510b2c7d3507b75d1399416485 (diff) | |
download | grecs-1fa2dd2c6587822ff682581643499c3c3b78c9ea.tar.gz grecs-1fa2dd2c6587822ff682581643499c3c3b78c9ea.tar.bz2 |
Minor fix.
* src/wordsplit.c (_wsplt_seterr_sub): Propagate error context.
-rw-r--r-- | src/wordsplit.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/wordsplit.c b/src/wordsplit.c index 6dba914..48312bb 100644 --- a/src/wordsplit.c +++ b/src/wordsplit.c @@ -195,21 +195,27 @@ _wsplt_subsplit (struct wordsplit *wsp, struct wordsplit *wss, return rc; } static void _wsplt_seterr_sub (struct wordsplit *wsp, struct wordsplit *wss) { + /* Clear user-defined error */ if (wsp->ws_errno == WRDSE_USERERR) free (wsp->ws_usererr); + /* Copy error state */ wsp->ws_errno = wss->ws_errno; if (wss->ws_errno == WRDSE_USERERR) { wsp->ws_usererr = wss->ws_usererr; wss->ws_errno = WRDSE_EOF; wss->ws_usererr = NULL; } + /* Copy error context */ + free (wsp->ws_errctx); + wsp->ws_errctx = wss->ws_errctx; + wss->ws_errctx = NULL; } static void wordsplit_init0 (struct wordsplit *wsp) { if (wsp->ws_flags & WRDSF_REUSE) |