Improve fallback shared_memory_dir().

Try SECURE_TMPDIR env variable, and fall back to TMPDIR or /tmp with a
warning and delay before proceeding so the user has a chance to ^C.

Signed-off-by: Thomas Hurst <tom@hur.st>