Starting in MariaDB 10.2 many of the api commands started setting errno erroneously. Backport of 5b934425