Add missing errno.h include statement and use int instead of errno_t.