• src/doors/syncmoo1/syncmoo1.h syncmoo1_config.c

    From Rob Swindell (on Debian Linux)@VERT to Git commit to main/sbbs/master on Thu Jul 9 01:55:11 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/380c52085ffc8bf1dea97ea2
    Modified Files:
    src/doors/syncmoo1/syncmoo1.h syncmoo1_config.c
    Log Message:
    syncmoo1: never let 1oom's config path fall back to $HOME

    sm_config_apply() only called 1oom's os_set_path_user() when -home was
    given. Without -home, os_get_path_user() lazily resolved and cached $XDG_CONFIG_HOME/1oom or $HOME/.config/1oom on first use, so a
    BBS-launched run with no -home wrote the player's 1oom config and our
    own temp files straight into the invoking (service) account's home
    directory -- already the cause of one accidental overwrite during
    testing.

    Fix os_set_path_user() to always run before anything else in the
    process can call os_get_path_user(): to the absolute -home directory
    when given, otherwise to the door's absolute cwd. 1oom's own $HOME/XDG
    fallback never gets a chance to fire. Update the syncmoo1.h contract
    comment to document this guarantee.

    Follow-up cleanup in sm_config_seed_1oom(), now that the user path is
    never empty in either mode:
    - drop the dead "no -home: nowhere to put the temps" guard/comment
    (os_get_path_user() never actually returned NULL/""), replacing it
    with a defensive comment describing the real (now-true) invariant,
    plus a note on the residual limitation that concurrent sessions
    sharing one cwd also share 1oom_config_*.txt and the temp names.
    - remove the leftover syncmoo1_base.tmp when cfg_save() fails
    mid-write: it opens with "w+" (create/truncate) and can fail via a
    later goto without cleaning up after itself, and blanking
    sm_base_cfg right after gates off sm_config_prune_user_cfg()'s own
    remove() of that path.
    - tidy the atexit-LIFO-ordering comment into a plain statement of the
    (unchanged) invariant instead of reasoning out loud.

    Verified: clean build, 4/4 ctest, and a scripted -new/-savequit run
    both without and with -home -- HOME stays empty either way, config
    lands in cwd or the -home dir as expected, and no *.tmp files are left
    behind in either mode.

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net