X-Git-Url: https://the.earth.li/gitweb/?a=blobdiff_plain;f=keydb%2Fkeydb_pg.c;h=85c16ccbdcf39d10c2e3aa0584e4da7c67517d49;hb=9aadc77b48c7826015f8ec87cebdc15d012c5f14;hp=c8392f721b9460800b73867c1189f63d4933313e;hpb=9d8830c7ea9fd00ded77072cdfd333c5c4e39813;p=onak.git diff --git a/keydb/keydb_pg.c b/keydb/keydb_pg.c index c8392f7..85c16cc 100644 --- a/keydb/keydb_pg.c +++ b/keydb/keydb_pg.c @@ -47,21 +47,28 @@ struct pg_fc_ctx { /** * keydb_fetchchar - Fetches a char from a file. */ -static int keydb_fetchchar(void *_ctx, size_t count, void *c) +static size_t keydb_fetchchar(void *_ctx, size_t count, void *c) { + int ret; + struct pg_fc_ctx *ctx = (struct pg_fc_ctx *) _ctx; - return (!lo_read(ctx->dbconn, ctx->fd, (char *) c, count)); + ret = lo_read(ctx->dbconn, ctx->fd, (char *) c, count); + + return (ret > 0) ? ret : 0; } /** * keydb_putchar - Puts a char to a file. */ -static int keydb_putchar(void *_ctx, size_t count, void *c) +static size_t keydb_putchar(void *_ctx, size_t count, void *c) { struct pg_fc_ctx *ctx = (struct pg_fc_ctx *) _ctx; + int ret; + + ret = lo_write(ctx->dbconn, ctx->fd, (char *) c, count); - return !(lo_write(ctx->dbconn, ctx->fd, (char *) c, count)); + return (ret > 0) ? ret : 0; } /**