X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ftdb%2Ftest%2Frun-corrupt.c;h=6f753ea6d46c81c9dbd3f9e388c1f3078c98e30e;hp=2109e936b1bf77eb645ffc7627f50896ed6b436e;hb=b10598ebdad2302c637c14961525c0d9cef937f5;hpb=e8dfb48ec9dd9a7575b179e8208cd2dd5c73bcce;ds=sidebyside diff --git a/ccan/tdb/test/run-corrupt.c b/ccan/tdb/test/run-corrupt.c index 2109e936..6f753ea6 100644 --- a/ccan/tdb/test/run-corrupt.c +++ b/ccan/tdb/test/run-corrupt.c @@ -43,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"); } }