Use strtonum to ensure only valid numbers are read from files.

This fixes a theoretically possible overflow issue spotted by Coverity; as
well as a (more likely?) case where negative numbers were passed to
extsmaild.
msg_path must be non-NULL at this point, so the check is redundant.

Spotted by Coverity.
Explicitly set umask for those systems where it has a silly default value.
fopen can tell us if a file doesn't exist, so remove separate check.

Indirectly spotted by Coverity.
Remove possible race condition when checking mode of file.

Since this was a sanity check for the user, rather than a security check,
there was little harm that could be done. However, explicit is better than
implicit.

Indirectly spotted by Coverity.
Ship a compat version of strtonum for those systems that don't have it.