Why not? Many other programs do it this way and work just fine -
if /etc/shadow doesn't exist, getspnam() will return NULL and the
password from /etc/passwd will be used. If you see any specific
problems with this, let me know.
> Why not check the presence of /etc/shadow and if it is present and size >
> 0 then proceed with shadow things ?
Because it's more code which is not necessary in most cases. I do it
only in programs which need to modify password files (passwd already
works with both shadow and non-shadow passwords in my current, not yet
unreleased source).
Besides, the implementation of getspnam() might change later, so there
shouldn't be too many programs with hardcoded check for /etc/shadow.
(Not that it is expected to change anytime soon, but...)
Regards,
Marek