home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.programmer
- Path: sparky!uunet!paladin.american.edu!darwin.sura.net!zaphod.mps.ohio-state.edu!rpi!fitzgb
- From: fitzgb@mml0.meche.rpi.edu (Brian Fitzgerald)
- Subject: Re: RPC server did not return status
- Message-ID: <q6y1sla@rpi.edu>
- Nntp-Posting-Host: mml0.meche.rpi.edu
- Organization: Rensselaer Polytechnic Institute, Troy, NY
- References: <1992Nov11.095253.23538@news.mentorg.com> <1992Nov18.032708.12062@linus.mitre.org>
- Date: Thu, 19 Nov 1992 15:26:24 GMT
- Lines: 70
-
- Randy Crawford writes:
- >In article <1992Nov11.095253.23538@news.mentorg.com> thiam-chye_sim@mentorg.com writes:
- >
- >No additional input to the server should be necessary. However, I believe a
- >return integer* from the server _is_ customary. After all, aren't the
- >rpcgenned functions (like whatever_1() ) typed to return an int? Be sure
-
- They return pointers, as far as I know.
-
- Sim Thiam Chye's rpcgen file generates the following client code:
-
- void *
- send_alarm_1(argp, clnt)
- body *argp;
- CLIENT *clnt;
- {
- static char res;
-
- bzero((char *)&res, sizeof(res));
- if (clnt_call(clnt, SEND_ALARM, xdr_body, argp, xdr_void, &res, TIMEOUT)
- != RPC_SUCCESS) {
- return (NULL);
- }
- return ((void *)&res);
- }
-
- Many standard rpc functions return void *. The NULLPROC is an example.
-
- >that the return pointer is to a global or static integer. Don't return the
- >address of an automatic/stack variable.
-
- Good advice.
-
- >Did you try using rpcgen on the HP on your whetever.x file, and then compiling
- >up the new HP rpcgenned code? The two rpcgens are a tad different (using
- >bzero() on the sun and goofing up memset() on the HP is "hpux" isn't defined).
- >It's worth a try.
- >--
- >| Randy Crawford crawford@mitre.org The MITRE Corporation
-
- In Thiam's code,
-
- typedef char *string;
- char sys_cmd[2048];
-
- void *send_alarm_1(list)
- body *list;
- {
- char buf1[2048] ;
- char *token;
- int i;
- int j = 60;
-
- strcpy(sys_cmd,"xalarm -geom +0+0 -nc -time +0 \"");
- strcat(buf1, list->msg);
- strcat(buf1, "\"");
- strcat(sys_cmd, buf1);
- system(sys_cmd);
- }
-
- I think strcat(buf1, list->msg); is trouble because buf1 is uninitialized.
-
- I have suggested
-
- strcpy(sys_cmd,"xalarm -geom +0+0 -nc -time +0 \"");
- strcat(sys_cmd, list->msg);
- strcat(sys_cmd, "\"");
- system(sys_cmd);
-
- Brian
-