PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Incompatibel ?



RedNuX
22-05-2003, 18:47
habe mit folgendem code schwierigkeiten, aber für mich irgendwie unverständlich,


#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <rpc/rpc.h>
#include <netdb.h>

extern struct sockaddr_in *saddr;

int
check_rpc_service(long program)
{
int sock = RPC_ANYSOCK;
CLIENT *client;
struct timeval timeout;
enum clnt_stat cstat;

timeout.tv_sec = 10;
timeout.tv_usec = 0;
client = clntudp_create(saddr, program, 1, timeout, &sock);
if(!client)
return -1;
timeout.tv_sec = 10;
timeout.tv_usec = 0;
cstat = RPC_TIMEDOUT;
cstat = clnt_call(client, 0, xdr_void, NULL, xdr_void, NULL, timeout);
if(cstat == RPC_TIMEDOUT)
{
timeout.tv_sec = 10;
timeout.tv_usec = 0;
cstat = clnt_call(client, 0, xdr_void, NULL, xdr_void, NULL, timeout);
}
clnt_destroy(client);
close(sock);
if(cstat == RPC_SUCCESS)
return 1;
else if(cstat == RPC_PROGVERSMISMATCH)
return 1;
else return 0;
}


Fehlermeldung:

root@lian tmp # gcc -c checkrpc.c
checkrpc.c: In function `check_rpc_service':
checkrpc.c:27: warning: passing arg 3 of pointer to function from incompatible pointer type
checkrpc.c:27: warning: passing arg 5 of pointer to function from incompatible pointer type
checkrpc.c:32: warning: passing arg 3 of pointer to function from incompatible pointer type
checkrpc.c:32: warning: passing arg 5 of pointer to function from incompatible pointer type
root@lian tmp #

27 = cstat = clnt_call(client, 0, xdr_void, NULL, xdr_void, NULL, timeout);
32 = cstat = clnt_call(client, 0, xdr_void, NULL, xdr_void, NULL, timeout);

dakjo
22-05-2003, 18:59
Müsste es nicht heissen



27 = cstat = clnt_call(client, 0, (void *)&xdr_void, NULL, (void *)&xdr_void, NULL, timeout);
32 = cstat = clnt_call(client, 0, (void *)&xdr_void, NULL, (void *)&xdr_void, NULL, timeout);


:confused:

Oder hab ich mich verzählt ?

RedNuX
22-05-2003, 23:36
das funzt super -danke-, nur warum? *grübel*

dakjo
23-05-2003, 13:41
Vielleicht weil es void Zeiger sind ?