]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
test_cfuse_cache_invalidate: check for errors
authorSage Weil <sage@inktank.com>
Tue, 9 Oct 2012 03:47:16 +0000 (20:47 -0700)
committerSage Weil <sage@inktank.com>
Tue, 9 Oct 2012 03:47:16 +0000 (20:47 -0700)
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 <sage@inktank.com>
src/test/test_cfuse_cache_invalidate.cc

index 44b64e46cf641d17f0d12288e3e5d7cdb3d31d1a..1389e5d75f89812e8266ce77f6489a1cb1912732 100644 (file)
@@ -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);