btw, do we really want to allow the caller to pass NULL as errmsg. Because, right now we are missing some checks (and that's even worse with my last patch).
btw, do we really want to allow the caller to pass NULL as errmsg. Because, right now we are missing some checks (and that's even worse with my last patch).