Commit 60fd912f authored by Per Cederqvist's avatar Per Cederqvist
Browse files

(restart_kom): Moved here from ramkomd.c.

parent aca899a7
/*
* $Id: log.c,v 0.16 1998/07/08 16:29:29 ceder Exp $
* $Id: log.c,v 0.17 1998/07/12 01:23:47 ceder Exp $
* Copyright (C) 1991, 1992, 1993, 1994, 1995 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -29,7 +29,7 @@
*/
static const char *
rcsid = "$Id: log.c,v 0.16 1998/07/08 16:29:29 ceder Exp $";
rcsid = "$Id: log.c,v 0.17 1998/07/12 01:23:47 ceder Exp $";
#include "rcs.h"
USE(rcsid);
......@@ -40,8 +40,10 @@ USE(rcsid);
#include <sys/types.h>
#include <time.h>
#include <unistd.h>
#include <errno.h>
#include "log.h"
#include "lyskomd.h"
/*
* Add a string to the log file.
......@@ -95,3 +97,54 @@ log (const char * format,
}
#endif /* !HAVE_VFPRINTF */
void
#if defined(HAVE_VFPRINTF) && defined(HAVE_STDARG_H)
restart_kom(const char * format, ...)
#else
restart_kom(format,
a, b, c, d, e, f, g)
const char *format;
int a, b, c, d, e, f, g;
#endif
{
#if defined(HAVE_VFPRINTF) && defined(HAVE_STDARG_H)
va_list AP;
#endif
#if defined(HAVE_GETCWD)
char pathname[1026];
#else /* !defined(HAVE_GETCWD) */
char *getwd(char *); /* +++ should be in sys/param.h */
# if defined(MAXPATHLEN)
char pathname[MAXPATHLEN];
# else
char pathname[1024];
# endif /* !defined(MAXPATHLEN) */
#endif /* !defined(HAVE_GETCWD) */
#if defined(HAVE_VFPRINTF) && defined(HAVE_STDARG_H)
va_start(AP, format);
logv(format, AP);
va_end(AP);
#else
log(format, a, b, c, d, e, f, g);
#endif
log("Previous message is fatal. Will dump core now.\n");
#ifdef HAVE_GETCWD
/* getcwd is POSIX, so try that first. */
if (getcwd(pathname, 1026) == NULL)
log("getcwd failed: errno %d\n", errno);
else
log("Search for the core in %s\n", pathname);
#else
if ( getwd(pathname) == NULL )
log("getwd failed: %s\n", pathname);
else
log("Search for the core in %s\n", pathname);
#endif
abort();
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment