[misc] Sanity check and error messages in misdn.c

Add some sanity checks, add some error checks, print
the __func__ in the error message too.

Patch from Andreas Eversberg
tree: 6136690642cb9a61127142ed40c642ea60894ab9
  1. doc/
  2. tests/
  3. tools/
  4. AUTHORS
  5. configure.in
  6. COPYING
  7. Makefile.am
  8. README