Found during the review of #1046, and pre-existing rather than introduced by it.
warc_abort_opt nulls state.warc, but the teardown that follows (XH_uninit → back_delete_all → back_finalize → warc_write_backtransaction) can lazily reopen the writer at src/htswarc.c:1886, which orphans a .tmp. The normal teardown tail has the identical ordering (src/htswarc.c:2293 then :2298), which is what rules out #1046 as the cause.
Using a WARC_DISABLED sentinel instead of NULL closes both paths, since the lazy reopen cannot tell "never opened" from "deliberately abandoned".
Found during the review of #1046, and pre-existing rather than introduced by it.
warc_abort_optnullsstate.warc, but the teardown that follows (XH_uninit→back_delete_all→back_finalize→warc_write_backtransaction) can lazily reopen the writer atsrc/htswarc.c:1886, which orphans a.tmp. The normal teardown tail has the identical ordering (src/htswarc.c:2293then:2298), which is what rules out #1046 as the cause.Using a
WARC_DISABLEDsentinel instead ofNULLcloses both paths, since the lazy reopen cannot tell "never opened" from "deliberately abandoned".