diff options
author | Shuai Xue <xueshuai@linux.alibaba.com> | 2023-01-12 14:43:14 +0800 |
---|---|---|
committer | Tony Luck <tony.luck@intel.com> | 2023-01-12 14:42:18 -0800 |
commit | 3f414a16c32958ae961ebc7fc3b48b9f28112ec2 (patch) | |
tree | a03435c5ca7976fb407a4e306d8ca915af8f8444 | |
parent | f276ebba2d1ff616e5a2c7673343f588843bcb64 (diff) | |
download | ras-tools-3f414a16c32958ae961ebc7fc3b48b9f28112ec2.tar.gz |
einj_mem_uc: fix compilation error about trigger_share
Some compilers (GCC 9.2.1) complain:
einj_mem_uc.c: In function ‘trigger_share’:
einj_mem_uc.c:656:3: error: a label can only be part of a statement and a declaration is not a statement
656 | char *p = mmap(NULL, pagesize, PROT_READ, MAP_SHARED, fileno(pcfile), 0);
| ^~~~
make: *** [<builtin>: einj_mem_uc.o] Error 1
Make all declarations precede all statements within the block.
Signed-off-by: Shuai Xue <xueshuai@linux.alibaba.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
-rw-r--r-- | einj_mem_uc.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/einj_mem_uc.c b/einj_mem_uc.c index 2e0d75a..67e1783 100644 --- a/einj_mem_uc.c +++ b/einj_mem_uc.c @@ -646,6 +646,7 @@ int trigger_thread(char *addr) int trigger_share(char *addr) { int pid, status; + char *p; switch (pid = fork()) { case -1: @@ -653,7 +654,7 @@ int trigger_share(char *addr) return -1; case 0: /* mmap share memory */ - char *p = mmap(NULL, pagesize, PROT_READ, MAP_SHARED, fileno(pcfile), 0); + p = mmap(NULL, pagesize, PROT_READ, MAP_SHARED, fileno(pcfile), 0); if (p == NULL) { fprintf(stderr, "%s: cannot mmap sharefile\n", progname); exit(1); |