]> granicus.if.org Git - strace/commitdiff
tests/readdir.c: use libtests
authorDmitry V. Levin <ldv@altlinux.org>
Wed, 6 Jan 2016 12:03:57 +0000 (12:03 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Wed, 6 Jan 2016 12:03:57 +0000 (12:03 +0000)
* tests/readdir.c: Use SKIP_MAIN_UNDEFINED.
(main): Use perror_msg_and_skip.

tests/readdir.c

index 2b161d3e8f37fd5d4b3902e5c692d53d7bd37645..85170aa431a83a70776d8a5274661a557af73ff5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Dmitry V. Levin <ldv@altlinux.org>
+ * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
 
 #ifdef __NR_readdir
 
-#include <assert.h>
-#include <dirent.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <unistd.h>
+# include <assert.h>
+# include <dirent.h>
+# include <fcntl.h>
+# include <stdio.h>
+# include <string.h>
+# include <sys/stat.h>
+# include <unistd.h>
 
 static const char fname[] =
        "A\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\nA\n"
@@ -79,7 +79,7 @@ main(int ac, const char **av)
        assert(!open(".", O_RDONLY | O_DIRECTORY));
        while ((rc = syscall(__NR_readdir, 0, &e, 1))) {
                if (rc < 0)
-                       return 77;
+                       perror_msg_and_skip("readdir");
                e.d_name[e.d_reclen] = '\0';
                printf("readdir(0, {d_ino=%lu, d_off=%lu, d_reclen=%u"
                       ", d_name=\"%s\"}) = %d\n",
@@ -97,10 +97,6 @@ main(int ac, const char **av)
 
 #else
 
-int
-main(void)
-{
-       return 77;
-}
+SKIP_MAIN_UNDEFINED("__NR_readdir")
 
 #endif