]> granicus.if.org Git - strace/commitdiff
tests/umount2.c: use libtests
authorDmitry V. Levin <ldv@altlinux.org>
Mon, 4 Jan 2016 23:47:59 +0000 (23:47 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Wed, 6 Jan 2016 00:05:41 +0000 (00:05 +0000)
* tests/umount2.c (main): Use perror_msg_and_fail.

tests/umount2.c

index bb415960e30dfeff6efacafc81be5d868a867334..45ed1a447f00ab54eac6f21c7ea845b227713d09 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
@@ -25,6 +25,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "tests.h"
 #include <stdio.h>
 #include <unistd.h>
 #include <sys/stat.h>
@@ -42,14 +43,13 @@ int
 main(void)
 {
        static const char sample[] = "umount2.sample";
-       if (mkdir(sample, 0700)) {
-               perror(sample);
-               return 77;
-       }
+       if (mkdir(sample, 0700))
+               perror_msg_and_fail("mkdir: %s", sample);
        (void) syscall(__NR_umount2, sample, 31);
        printf("%s(\"%s\", MNT_FORCE|MNT_DETACH|MNT_EXPIRE|UMOUNT_NOFOLLOW|0x10)"
               " = -1 EINVAL (%m)\n", TEST_SYSCALL_STR, sample);
-       (void) rmdir(sample);
+       if (rmdir(sample))
+               perror_msg_and_fail("rmdir: %s", sample);
        puts("+++ exited with 0 +++");
        return 0;
 }