Compiling openvas-scanner branch openvas-scanner-5.1: error cast between incompatible pointer types

Scanning dependencies of target openvassd
[  6%] Building C object src/CMakeFiles/openvassd.dir/attack.c.o
/home/xxx/src/gvm/openvas-scanner/src/attack.c: In function ‘attack_network’:
/home/xxx/src/gvm/openvas-scanner/src/attack.c:1093:29: error: cast between incompatible function types 
from ‘void (*)(struct attack_start_args *)’ to ‘int (*)(void *)’ [-Werror=cast-function-type]
       pid = create_process ((process_func_t) attack_start, &args);
                         ^
cc1: all warnings being treated as errors
make[2]: *** [src/CMakeFiles/openvassd.dir/build.make:63: src/CMakeFiles/openvassd.dir/attack.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:128: src/CMakeFiles/openvassd.dir/all] Error 2
make: *** [Makefile:163: all] Error 2

The warning (as of compiler default) is transformed into an error by calling the compiler with -Werror=cast-function-type set.

The problem is: ‘void (*)(struct attack_start_args *)’ to ‘int (*)(void *)’:

pid = create_process ((process_func_t) attack_start, &args)

Hi,

please report such code specific issues directly to the issue tracker of the affected component. In the case of openvas-scanner this would be Issues · greenbone/openvas-scanner · GitHub.

An existing PR fixing this for openvas-scanner-6.0 was available there, might be possible that a backport for this is required:

Yes, it is fixed in 6.0, but not 5.1. So you are right: hast to be backported!