> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of Xu Qiang
> Sent: Tuesday, May 17, 2005 9:58 PM
> To: Dan Nelson; Xu Qiang
> Cc: Giorgos Keramidas; [email protected]
> Subject: RE: The availability of socketbits.h?
>
>
> Dan Nelson wrote:
> > The rest of the code in command.c makes use of the
> command_count value
> > and assumes that all the array elements are fully populated.  The
> > qsort routime tried to compare a NULL comm_name value and seg
> > faulted.  His fix would have worked if the rest of the program used
> > the same code loop as the one at command.c:1149, but it doesn't.
>
> Yeah, you hit the point again!
>
> Just found the variable noofcomms (= COUNTOF(command_list)) is
> used in the function qsort()
> ---------------------------------------------------------------------
> qsort(&(command_list),noofcomms,sizeof command_list[0],&command_cmp);
> ---------------------------------------------------------------------
>
> No wonder trailing NULL element at the end of the array
> command_list[] is used in qsort(), and the segmentation fault.
>
> Since the number of actual non-NULL elements in the array is
> one less than the array's size, I changed the calculation of
> noofcomms as:
> ---------------------------------------------------------------------
> noofcomms = COUNTOF(command_list) - 1;
> ---------------------------------------------------------------------
>
> Now the program can work properly. :)
>
> > The author may not have tested it on many systems, and since the
> > source is so old (relatively speaking), standards have changed.  It's
> > no longer acceptable to provide your own prototypes for system
> > functions, for example (which was the cause of your first few compile
> > errors).
>
> I am very lucky to have you and Giorgos around to help me in
> compiling this software. Thank you two so much for your help
> and patience!
>
> with my best wishes,
> Xu Qiang
>

Would you post a diff of the files you had to change to the list once
you get it running?

Thanks,
Ted

_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to