X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ftdb%2Ftest%2Frun-corrupt.c;h=6f753ea6d46c81c9dbd3f9e388c1f3078c98e30e;hp=bea7dbcdf490218e4cd8ab0a4983246f6fb8be13;hb=b10598ebdad2302c637c14961525c0d9cef937f5;hpb=44eea6ca52a2de5a817cf54d5d206969845dee3d diff --git a/ccan/tdb/test/run-corrupt.c b/ccan/tdb/test/run-corrupt.c index bea7dbcd..6f753ea6 100644 --- a/ccan/tdb/test/run-corrupt.c +++ b/ccan/tdb/test/run-corrupt.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -42,9 +43,11 @@ static void tdb_flip_bit(struct tdb_context *tdb, unsigned int bit) ((unsigned char *)tdb->map_ptr)[off] ^= mask; else { unsigned char c; - pread(tdb->fd, &c, 1, off); + if (pread(tdb->fd, &c, 1, off) != 1) + err(1, "pread"); c ^= mask; - pwrite(tdb->fd, &c, 1, off); + if (pwrite(tdb->fd, &c, 1, off) != 1) + err(1, "pwrite"); } }