tests: fix the return value of bind, srv, and stat
authorBarret Rhoden <brho@cs.berkeley.edu>
Fri, 14 Jun 2019 21:55:53 +0000 (17:55 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Thu, 11 Jul 2019 18:29:21 +0000 (14:29 -0400)
Return 0 on success.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
tests/bind.c
tests/srv.c
tests/stat.c

index e78894d..7224945 100644 (file)
@@ -67,7 +67,9 @@ int main(int argc, char *argv[])
                       src_path, flag);
        ret = syscall(SYS_nbind, src_path, strlen(src_path), onto_path,
                      strlen(onto_path), flag);
                       src_path, flag);
        ret = syscall(SYS_nbind, src_path, strlen(src_path), onto_path,
                      strlen(onto_path), flag);
-       if (ret < 0)
+       if (ret < 0) {
                perror("Bind failed");
                perror("Bind failed");
-       return ret;
+               return -1;
+       }
+       return 0;
 }
 }
index cfa352e..c3dcb83 100644 (file)
@@ -56,4 +56,5 @@ int main(int argc, char *argv[])
                close(dfd);
                exit(-1);
        }
                close(dfd);
                exit(-1);
        }
+       return 0;
 }
 }
index 8a6c38a..b5d7433 100644 (file)
@@ -21,6 +21,7 @@ int main(int argc, char *argv[])
        retval = stat(argv[1], &st);
        if (retval < 0) {
                perror("Stat failed");
        retval = stat(argv[1], &st);
        if (retval < 0) {
                perror("Stat failed");
+               return -1;
        } else {
                printf("STAT RESULTS\n---------------------\n");
                printf("dev       : %d\n", st.st_dev);
        } else {
                printf("STAT RESULTS\n---------------------\n");
                printf("dev       : %d\n", st.st_dev);
@@ -37,4 +38,5 @@ int main(int argc, char *argv[])
                printf("mtime     : %d\n", st.st_mtime);
                printf("ctime     : %d\n", st.st_ctime);
        }
                printf("mtime     : %d\n", st.st_mtime);
                printf("ctime     : %d\n", st.st_ctime);
        }
+       return 0;
 }
 }