- Use strerror() instead of sys_errlist[] for increased portability

(Needed for SunOS)
This commit is contained in:
Guus Sliepen 2000-09-06 11:49:05 +00:00
parent 66e535a729
commit 4dde583bc9
4 changed files with 20 additions and 18 deletions

View file

@ -19,7 +19,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: conf.c,v 1.9.4.8 2000/08/09 14:02:15 guus Exp $ $Id: conf.c,v 1.9.4.9 2000/09/06 11:49:03 guus Exp $
*/ */
@ -214,7 +214,7 @@ read_config_file(const char *fname)
cp cp
if((fp = fopen (fname, "r")) == NULL) if((fp = fopen (fname, "r")) == NULL)
{ {
fprintf(stderr, _("Could not open %s: %s\n"), fname, sys_errlist[errno]); fprintf(stderr, _("Could not open %s: %s\n"), fname, strerror(errno));
return 1; return 1;
} }

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: net.c,v 1.35.4.26 2000/08/09 14:02:16 guus Exp $ $Id: net.c,v 1.35.4.27 2000/09/06 11:49:03 guus Exp $
*/ */
#include "config.h" #include "config.h"
@ -934,7 +934,7 @@ cp
if(x) if(x)
{ {
syslog(LOG_ERR, _("Incoming data socket error for %s (%s): %s"), syslog(LOG_ERR, _("Incoming data socket error for %s (%s): %s"),
cl->vpn_hostname, cl->real_hostname, sys_errlist[x]); cl->vpn_hostname, cl->real_hostname, strerror(x));
return -1; return -1;
} }
@ -1132,13 +1132,7 @@ cp
if(x) if(x)
{ {
syslog(LOG_ERR, _("Metadata socket error for %s (%s): %s"), syslog(LOG_ERR, _("Metadata socket error for %s (%s): %s"),
cl->vpn_hostname, cl->real_hostname, sys_errlist[x]); cl->vpn_hostname, cl->real_hostname, strerror(x));
return -1;
}
if(cl->buflen >= MAXBUFSIZE)
{
syslog(LOG_ERR, _("Metadata read buffer overflow!"));
return -1; return -1;
} }
@ -1233,6 +1227,12 @@ cp
} }
} }
if(cl->buflen >= MAXBUFSIZE)
{
syslog(LOG_ERR, _("Metadata read buffer overflow!"));
return -1;
}
cl->last_ping_time = time(NULL); cl->last_ping_time = time(NULL);
cl->want_ping = 0; cl->want_ping = 0;
cp cp
@ -1264,7 +1264,7 @@ cp
*/ */
getsockopt(p->socket, SOL_SOCKET, SO_ERROR, &x, &l); getsockopt(p->socket, SOL_SOCKET, SO_ERROR, &x, &l);
syslog(LOG_ERR, _("Outgoing data socket error for %s (%s): %s"), syslog(LOG_ERR, _("Outgoing data socket error for %s (%s): %s"),
p->vpn_hostname, p->real_hostname, sys_errlist[x]); p->vpn_hostname, p->real_hostname, strerror(x));
terminate_connection(p); terminate_connection(p);
return; return;
} }

View file

@ -16,7 +16,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: netutl.c,v 1.12.4.7 2000/08/17 16:51:07 guus Exp $ $Id: netutl.c,v 1.12.4.8 2000/09/06 11:49:05 guus Exp $
*/ */
#include "config.h" #include "config.h"
@ -33,6 +33,7 @@
#include <utils.h> #include <utils.h>
#include <xalloc.h> #include <xalloc.h>
#include "errno.h"
#include "conf.h" #include "conf.h"
#include "encr.h" #include "encr.h"
#include "net.h" #include "net.h"
@ -217,7 +218,7 @@ cp
if(!(h = gethostbyname(p))) if(!(h = gethostbyname(p)))
{ {
fprintf(stderr, _("Error looking up `%s': %s\n"), p, sys_errlist[h_errno]); fprintf(stderr, _("Error looking up `%s': %s\n"), p, strerror(errno));
return NULL; return NULL;
} }

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: tincd.c,v 1.10.4.8 2000/08/17 16:51:08 guus Exp $ $Id: tincd.c,v 1.10.4.9 2000/09/06 11:49:05 guus Exp $
*/ */
#include "config.h" #include "config.h"
@ -30,6 +30,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <syslog.h> #include <syslog.h>
#include <unistd.h> #include <unistd.h>
#include <signal.h>
#ifdef HAVE_SYS_IOCTL_H #ifdef HAVE_SYS_IOCTL_H
# include <sys/ioctl.h> # include <sys/ioctl.h>
@ -454,10 +455,10 @@ RETSIGTYPE
sighuh(int a) sighuh(int a)
{ {
if(cp_file) if(cp_file)
syslog(LOG_NOTICE, _("Got unexpected signal %d after %s line %d"), syslog(LOG_NOTICE, _("Got unexpected %s after %s line %d"),
a, cp_file, cp_line); strsignal(a), cp_file, cp_line);
else else
syslog(LOG_NOTICE, _("Got unexpected signal %d"), a); syslog(LOG_NOTICE, _("Got unexpected %s"), strsignal(a));
} }
void void