Subject: FVWM: fvwm-2.0.42 installation bug.

From: Arnon Kanfi <[email-masked]>
Date: Mon, 29 Apr 96 17:12:49 EDT

There is an unresolved reference to strerror() in builtins.c on SunOs (I am
using SunOs 4.1.4 but I believe that this problem will occur on other
versions as well). My fix was to add the following lines to the top of the
file:

#if defined __sun__ && !defined SYSV
extern char *sys_errlist[] ;
#define strerror(err)   sys_errlist[err]
#endif

This is not ideal because garbage error code may cause core dumps. A function
which does boundary checking would be better, however it should be OK for most
cases.

Arnon
--
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].

---

From: [email-masked] (Amir J. Katz)
Date: Tue, 30 Apr 96 11:01:25 IDT

>>>>> "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:

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].