+int
+pool_error(Pool *pool, int ret, const char *format, ...)
+{
+ va_list args;
+ int l;
+ va_start(args, format);
+ if (!pool->errstr)
+ {
+ pool->errstra = 1024;
+ pool->errstr = solv_malloc(pool->errstra);
+ }
+ if (!*format)
+ {
+ *pool->errstr = 0;
+ l = 0;
+ }
+ else
+ l = vsnprintf(pool->errstr, pool->errstra, format, args);
+ va_end(args);
+ if (l >= 0 && l + 1 > pool->errstra)
+ {
+ pool->errstra = l + 256;
+ pool->errstr = solv_realloc(pool->errstr, pool->errstra);
+ va_start(args, format);
+ l = vsnprintf(pool->errstr, pool->errstra, format, args);
+ va_end(args);
+ }
+ if (l < 0)
+ strcpy(pool->errstr, "unknown error");
+ if (pool->debugmask & SOLV_ERROR)
+ pool_debug(pool, SOLV_ERROR, "%s\n", pool->errstr);
+ return ret;
+}
+
+char *
+pool_errstr(Pool *pool)
+{
+ return pool->errstr ? pool->errstr : "no error";
+}
+