Commit fee22064 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

Never change directory before trying to dump core.

Log cwd in restar_kom before dumping core.
parent 97ddb95a
......@@ -18,6 +18,7 @@
#include <locale.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/param.h>
#include <netinet/in.h>
#include <unistd.h>
#include "std-disclaimer.h"
......@@ -155,7 +156,6 @@ sighandler_quit (int sig)
log ("Signal QUIT received - syncing...\n");
cache_sync_all();
log ("Dumping core now.\n");
chdir ("/usr/lyskom/etc");
abort();
}
......@@ -174,7 +174,6 @@ sighandler_usr2 (int sig)
log ("Signal USR2 received - will dump core now. (Check that child dies.)\n");
if ((child = fork()) == 0)
{
chdir ("/usr/lyskom/etc");
abort();
log ("Abort() failed!!!");
exit(1);
......@@ -301,11 +300,18 @@ void
restart_kom(const char * format, ...)
{
va_list AP;
char pathname[MAXPATHLEN];
char *getwd(char *pathname); /* +++ should be in sys/param.h */
va_start(AP, format);
logv(format, AP);
va_end(AP);
log("Previous message is fatal. Will dump core now.\n");
if ( getwd(pathname) == NULL )
log("getwd failed: %s\n", pathname);
else
log("Search for the core in %s\n", pathname);
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