[PATCH liburing 1/3] test/io_uring_setup: Don't use `__errno` as local variable name

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This commit fixes build for armv8l.

On some systems, the macro `errno` is defined as
`#define errno (*__errno())`

It is clear that `__errno` is a global function on such systems.

The problem is, `io_uring_setup.c` uses `int __errno` as a local
variable, so it shadows the `__errno` function, result in the
following error:

```
       CC io_uring_setup
  io_uring_setup.c:116:12: error: called object type 'int' is not a function or function pointer
          __errno = errno;
                    ^~~~~
  /usr/include/errno.h:58:24: note: expanded from macro 'errno'
  #define errno (*__errno())
                  ~~~~~~~^
  1 error generated.
  make[1]: *** [Makefile:163: io_uring_setup] Error 1
  make[1]: *** Waiting for unfinished jobs....
```

Fix this by not using `__errno` as local variable name.

Reported-by: Louvian Lyndal <louvianlyndal@xxxxxxxxx>
Tested-by: Louvian Lyndal <louvianlyndal@xxxxxxxxx>
Signed-off-by: Ammar Faizi <ammarfaizi2@xxxxxxxxx>
---
 test/io_uring_setup.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/test/io_uring_setup.c b/test/io_uring_setup.c
index a0709a7..94b54fd 100644
--- a/test/io_uring_setup.c
+++ b/test/io_uring_setup.c
@@ -99,7 +99,7 @@ dump_resv(struct io_uring_params *p)
 int
 try_io_uring_setup(unsigned entries, struct io_uring_params *p, int expect, int error)
 {
-	int ret, __errno;
+	int ret, err;
 
 	printf("io_uring_setup(%u, %p), flags: %s, feat: %s, resv: %s, sq_thread_cpu: %u\n",
 	       entries, p, flags_string(p), features_string(p), dump_resv(p),
@@ -113,13 +113,13 @@ try_io_uring_setup(unsigned entries, struct io_uring_params *p, int expect, int
 			close(ret);
 		return 1;
 	}
-	__errno = errno;
-	if (expect == -1 && error != __errno) {
-		if (__errno == EPERM && geteuid() != 0) {
+	err = errno;
+	if (expect == -1 && error != err) {
+		if (err == EPERM && geteuid() != 0) {
 			printf("Needs root, not flagging as an error\n");
 			return 0;
 		}
-		printf("expected errno %d, got %d\n", error, __errno);
+		printf("expected errno %d, got %d\n", error, err);
 		return 1;
 	}
 
-- 
2.30.2




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux