Subject: Re: FVWM: fvwm-2.0.42 installation bug.

From: Arnon Kanfi <[email-masked]>
Date: Wed, 1 May 96 00:47:09 EDT

Thanks for the tip. If you really want to play it safe you should also
check for negative errno values or cast these errno to unsigned. Unfortunately
I don't have the Sun compiler so I don't have a choice.

By the way what is New Dimension Software?

Arnon
Amir J. Katz writes:
 > >>>>> "Arnon" == Arnon Kanfi <[email-masked]> writes:
 > 
 > Arnon; There is an unresolved reference to strerror() in builtins.c on SunOs (I am
 > Arnon; using SunOs 4.1.4 but I believe that this problem will occur on other
 > Arnon; versions as well). My fix was to add the following lines to the top of the
 > Arnon; file:
 > 
 > Arnon; #if defined __sun__ && !defined SYSV
 > Arnon; extern char *sys_errlist[] ;
 > Arnon; #define strerror(err)   sys_errlist[err]
 > Arnon; #endif
 > 
 > Arnon; This is not ideal because garbage error code may cause core dumps. A function
 > Arnon; which does boundary checking would be better, however it should be OK for most
 > Arnon; cases.
 > 
 > Another potenial problem with this workaround is that the
 > sys_errlist array may be smaller than 'err' elements.
 > To quote from the SunOS man page of perror() function:
 > ...
 >      int sys_nerr;
 >      char *sys_errlist[];
 >      int errno;
 > ...
 > "To simplify variant formatting of messages,  the  vector  of
 >      message  strings  sys_errlist is provided; errno can be used
 >      as an index in this table to get the message string  without
 >      the  newline.   sys_nerr  is the number of messages provided
 >      for in the table; it should be  checked  because  new  error
 >      codes  may  be  added to the system before they are added to
 >      the table."
 > 
 > So the correct fix (IMHO) would be:
 > 
 > #if defined __sun__ && !defined SYSV
 > extern char *sys_errlist[] ;
 > extern int  sys_nerr;
 > 
 > #define strerror(err)  \
 >    (err < sys_nerr) ? sys_errlist[err] : sprintf ("Unknown errno %d", err)
 > #endif
 > 
 > An alternative (that I use) is: if you have Sun's SPARCompiler, you
 > can still compile with gcc, just add the libansi.a library to the link:
 > It's in <path>/SC3.0.1/lib/libansi.a
 > 
 > /* Amir J. Katz  E-mail: [email-masked]   WWW: http://www.ddddf.com */
 > /* New Dimension Software, LTD., Tel-Aviv, Israel                   */
 > /* .. I busted a mirror and got seven years bad luck, but         ..*/
 > /* .. my lawyer thinks he can get me five.        (Steven Wright) ..*/
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].