From: Danny Al-Gaaf Date: Wed, 20 Mar 2013 15:37:37 +0000 (+0100) Subject: test_short_dio_read.c: add proper error handling X-Git-Tag: v0.60~29^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a8a5683e6dc20efd1beff8c3a1396bd9299cbe33;p=ceph.git test_short_dio_read.c: add proper error handling Signed-off-by: Danny Al-Gaaf --- diff --git a/qa/workunits/direct_io/test_short_dio_read.c b/qa/workunits/direct_io/test_short_dio_read.c index f65ce4546bd0..502485557400 100644 --- a/qa/workunits/direct_io/test_short_dio_read.c +++ b/qa/workunits/direct_io/test_short_dio_read.c @@ -22,7 +22,20 @@ int main() printf("writing first 3 bytes of 10k file\n"); r = write(fd, "foo", 3); + if (r == -1) { + err = errno; + printf("error: write() failed with: %d (%s)\n", err, strerror(err)); + close(fd); + exit(err); + } r = ftruncate(fd, 10000); + if (r == -1) { + err = errno; + printf("error: ftruncate() failed with: %d (%s)\n", err, strerror(err)); + close(fd); + exit(err); + } + fsync(fd); close(fd);