Whamcloud - gitweb
b=19720
[fs/lustre-release.git] / lustre / liblustre / tests / sanity.c
index 0fe2645..c0c3c05 100644 (file)
@@ -579,7 +579,7 @@ static int check_file_size(char *file, long long size)
         }
         if (statbuf.st_size != size) {
                 printf("size of %s: %lld != %lld\n", file,
-                       (long long)statbuf.st_size, size);
+                       (long long)statbuf.st_size, (long long )size);
                 return(-1);
         }
         return 0;
@@ -614,7 +614,7 @@ int t20(char *name)
         int fd;
         struct iovec iov[2];
         char buf[100];
-        ssize_t ret;
+        long ret;
         ENTER("trap app's general bad pointer for file i/o");
         snprintf(file, MAX_PATH_LENGTH, "%s/test_t20_file", lustre_path);
 
@@ -731,7 +731,7 @@ int t22(char *name)
         int fd;
         char *str = "1234567890";
         char buf[100];
-        ssize_t ret;
+        long ret;
         ENTER("make sure O_APPEND take effect");
         snprintf(file, MAX_PATH_LENGTH, "%s/test_t22_file", lustre_path);
 
@@ -1093,8 +1093,14 @@ int t52(char *name)
         printf("st_atime=%s", ctime(&statbuf.st_atime));
         atime = statbuf.st_atime;
         for (i = 0; i < 3; i++) {
+                ssize_t num_read;
                 sleep(2);
-                read(fd, buf, sizeof(buf));
+                /* should not ignore read(2)'s return value */
+                num_read = read(fd, buf, sizeof(buf));
+                if (num_read < 0 ) {
+                        printf("read from %s: %s\n", file, strerror(errno));
+                        return -1;
+                }
                 stat(file, &statbuf);
                 printf("st_atime=%s", ctime(&statbuf.st_atime));
                 diff = statbuf.st_atime - atime;
@@ -1361,7 +1367,7 @@ int t56(char *name)
         int fd;
         size_t nbytes;
         off_t basep = 0;
-        ssize_t rc = 0;
+        long rc = 0;
         cfs_dirent_t dir;
 
         ENTER("getdirentries should fail if nbytes is too small");