/*
- * 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
# define TEST_SYSCALL_NAME fcntl
# include "struct_flock.c"
-#define TEST_FLOCK64_EINVAL(cmd) test_flock64_einval(cmd, #cmd)
+# define TEST_FLOCK64_EINVAL(cmd) test_flock64_einval(cmd, #cmd)
static void
test_flock64_einval(const int cmd, const char *name)
int
main(void)
{
- if (create_sample())
- return 77;
-
+ create_sample();
test_flock();
test_flock64();
#else
-int
-main(void)
-{
- return 77;
-}
+SKIP_MAIN_UNDEFINED("__NR_fcntl")
#endif
/*
- * 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
# define TEST_SYSCALL_NAME fcntl64
# include "struct_flock.c"
-#define TEST_FLOCK64_EINVAL(cmd) test_flock64_einval(cmd, #cmd)
+# define TEST_FLOCK64_EINVAL(cmd) test_flock64_einval(cmd, #cmd)
static void
test_flock64_einval(const int cmd, const char *name)
{
TEST_FLOCK64_EINVAL(F_SETLK64);
TEST_FLOCK64_EINVAL(F_SETLKW64);
-#ifdef F_OFD_SETLK
+# ifdef F_OFD_SETLK
TEST_FLOCK64_EINVAL(F_OFD_SETLK);
TEST_FLOCK64_EINVAL(F_OFD_SETLKW);
-#endif
+# endif
struct_kernel_flock64 fl = {
.l_type = F_RDLCK,
int
main(void)
{
- if (create_sample())
- return 77;
-
+ create_sample();
test_flock();
test_flock64();
#else
-int
-main(void)
-{
- return 77;
-}
+SKIP_MAIN_UNDEFINED("__NR_fcntl64")
#endif
/*
- * 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
TEST_SYSCALL_STR, FILE_LEN);
}
-static int
+static void
create_sample(void)
{
char fname[] = TEST_SYSCALL_STR "_XXXXXX";
(void) close(0);
- return mkstemp(fname) || unlink(fname) || ftruncate(0, FILE_LEN) ? 77 : 0;
+ if (mkstemp(fname))
+ perror_msg_and_fail("mkstemp: %s", fname);
+ if (unlink(fname))
+ perror_msg_and_fail("unlink: %s", fname);
+ if (ftruncate(0, FILE_LEN))
+ perror_msg_and_fail("ftruncate");
}