From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Tomas By" Newsgroups: gmane.lisp.guile.user Subject: RPC xdr_free segmentation fault Date: Mon, 10 Nov 2014 01:37:00 +0100 Message-ID: <4f4e17196a1586a8a5109c9ff8fe8883.squirrel@webmail.xs4all.nl> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1415590362 27089 80.91.229.3 (10 Nov 2014 03:32:42 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 10 Nov 2014 03:32:42 +0000 (UTC) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Mon Nov 10 04:32:35 2014 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XnfiU-0006gO-N3 for guile-user@m.gmane.org; Mon, 10 Nov 2014 04:32:34 +0100 Original-Received: from localhost ([::1]:40778 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XnfiU-0004Gn-Bf for guile-user@m.gmane.org; Sun, 09 Nov 2014 22:32:34 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39008) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xncyj-0000O3-Q3 for guile-user@gnu.org; Sun, 09 Nov 2014 19:37:17 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xncyc-0001JD-8Y for guile-user@gnu.org; Sun, 09 Nov 2014 19:37:09 -0500 Original-Received: from lb1-smtp-cloud6.xs4all.net ([194.109.24.24]:47615) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xncyc-0001J2-1h for guile-user@gnu.org; Sun, 09 Nov 2014 19:37:02 -0500 Original-Received: from webmail.xs4all.nl ([194.109.26.20]) by smtp-cloud6.xs4all.net with ESMTP id Dcd01p0070S1Tsa01cd0bM; Mon, 10 Nov 2014 01:37:00 +0100 Original-Received: from 184.182.233.2 (SquirrelMail authenticated user tby) by webmail.xs4all.nl with HTTP; Mon, 10 Nov 2014 01:37:00 +0100 User-Agent: SquirrelMail/1.4.18 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 194.109.24.24 X-Mailman-Approved-At: Sun, 09 Nov 2014 22:32:26 -0500 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:11626 Archived-At: Hi all, I'm trying to write a Guile/C RPC client (I know about guile-rpc but would like to get this working also). The dir.x and server code is the standard RPC example. I have only modified the client (code below). It works fine as far as the xdr_free at the bottom, which causes a segmentation fault. Any help appreciated. /Tomas ---------- begin client.c ---------- #include #include "dir.h" /* generated by rpcgen */ #include #include CLIENT* clnt; SCM readdir_wrapper(SCM o) { if (scm_is_string(o)) { char* s; readdir_res* result; namelist nl; scm_dynwind_begin(0); s = scm_to_locale_string(o); scm_dynwind_free(s); result = readdir_1(s,clnt); scm_dynwind_end(); if (result == (readdir_res*)NULL) { clnt_perror(clnt,"localhost"); } else { if (result->erna != 0) { errno = result->erna; perror(s); } else { for (nl = result->readdir_res_u.list; nl != NULL; nl = nl->next) { printf("%s\n",nl->name); } printf("\n"); } xdr_free((xdrproc_t)xdr_readdir_res,(char*)result); } } else { scm_wrong_type_arg("read-dir",1,o); } } static void inner_main(void* data,int argc,char** argv) { scm_c_define_gsubr("read-dir",1,0,0,readdir_wrapper); scm_shell(argc,argv); } int main(int argc,char* argv[]) { clnt = clnt_create("localhost",DIRPROG,DIRVERS,"tcp"); if (clnt == (CLIENT*)NULL) { clnt_pcreateerror("localhost"); exit(1); } scm_boot_guile(argc,argv,inner_main,NULL); /*clnt_destroy(clnt);*/ return 0; } ---------- end client.c ----------