From: Sage Weil Date: Tue, 9 Oct 2012 03:47:16 +0000 (-0700) Subject: test_cfuse_cache_invalidate: check for errors X-Git-Tag: v0.54~75 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d68985fddcfaef05f7b9119d19718c019031f5ef;p=ceph.git test_cfuse_cache_invalidate: check for errors CID 731941 (#1 of 2): Argument cannot be negative (NEGATIVE_RETURNS) At (6): "fd" is passed to a parameter that cannot be negative. Signed-off-by: Sage Weil --- diff --git a/src/test/test_cfuse_cache_invalidate.cc b/src/test/test_cfuse_cache_invalidate.cc index 44b64e46cf64..1389e5d75f89 100644 --- a/src/test/test_cfuse_cache_invalidate.cc +++ b/src/test/test_cfuse_cache_invalidate.cc @@ -19,7 +19,10 @@ int main(int argc, char *argv[]) { if (p != 0) { int done = 0; int fd = open(argv[1], O_RDWR|O_CREAT, 0644); - if (fd < 0) perror(argv[1]); + if (fd < 0) { + perror(argv[1]); + return 1; + } int i = 0; while(!done) { @@ -36,6 +39,11 @@ int main(int argc, char *argv[]) { } else { sleep(1); int fd = open(argv[2], O_RDONLY, 0644); + if (fd < 0) { + perror(argv[2]); + return 1; + } + printf("reading\n"); assert(pread(fd, buf, REGION, 0) == REGION); close(fd);