edit-util: clean up run_editor() a bit
authorMike Yuan <me@yhndnzj.com>
Sun, 7 Jul 2024 15:21:08 +0000 (17:21 +0200)
committerMike Yuan <me@yhndnzj.com>
Mon, 12 Aug 2024 14:04:11 +0000 (16:04 +0200)
commit7a729f876b2494e2f1d1def73b828a9b70dd4723
tree1ffa4e096e88a83b5896df3d7d22f029f8a97b2a
parent10ac85d0da5bd126d02f62523c21427f66e1e6c1
edit-util: clean up run_editor() a bit

- Add missing assertions
- Close all fds before spawning editor
- Use FOREACH_STRING() + empty_to_null() where appropriate
  Note that this slightly changes the behavior, in that
  empty envvars would be treated as unset and we'd try
  the next candidate. But the new behavior is better IMO.
src/shared/edit-util.c