tests/lseek.c: cleanup
* tests/lseek.c (main): Use errno2name, stop using assert.
diff --git a/tests/lseek.c b/tests/lseek.c
index 227c4e3..72efc6e 100644
--- a/tests/lseek.c
+++ b/tests/lseek.c
@@ -41,20 +41,19 @@
{
const kernel_ulong_t offset = (kernel_ulong_t) 0xfacefeeddeadbeefULL;
- if (sizeof(offset) > sizeof(long))
- assert(lseek(-1, offset, SEEK_SET) == -1);
- else
- assert(syscall(__NR_lseek, -1L, offset, SEEK_SET) == -1);
-
- if (EBADF != errno)
- perror_msg_and_skip("lseek");
-
- if (sizeof(offset) > sizeof(long))
- printf("lseek(-1, %lld, SEEK_SET) = -1 EBADF (%m)\n",
- (long long) offset);
- else
- printf("lseek(-1, %ld, SEEK_SET) = -1 EBADF (%m)\n",
- (long) offset);
+ if (sizeof(offset) > sizeof(long)) {
+ /*
+ * Cannot use syscall because it takes long arguments.
+ * Let's call lseek with hope it will invoke lseek syscall.
+ */
+ long long rc = lseek(-1, offset, SEEK_SET);
+ printf("lseek(-1, %lld, SEEK_SET) = %lld %s (%m)\n",
+ (long long) offset, rc, errno2name());
+ } else {
+ long rc = syscall(__NR_lseek, -1L, offset, SEEK_SET);
+ printf("lseek(-1, %ld, SEEK_SET) = %ld %s (%m)\n",
+ (long) offset, rc, errno2name());
+ }
puts("+++ exited with 0 +++");
return 0;