gdbhelper.c revision 814bf67459ad405a157af0b8940602024d7fadfe
/* Copyright (c) 2006-2015 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <time.h>
{
if (argc < 2)
i_fatal("Usage: gdbhelper <program> [<args>]");
switch (pid) {
case 1:
i_fatal("fork() failed: %m");
case 0:
/* child */
default:
i_fatal("pipe() failed: %m");
cmd = "handle SIGPIPE nostop\n"
"handle SIGALRM nostop\n"
"handle SIG32 nostop\n"
"cont\n"
"bt full\n"
"quit\n";
i_fatal("write() failed: %m");
i_fatal("dup2() failed: %m");
i_fatal("system() failed: %m");
i_fatal("wait() failed: %m");
char buf[1024];
if (fd_log < 0)
}
if (ret < 0)
i_fatal("read(pipe) failed: %m");
i_close_fd(&fd_log);
}
}
return 0;
}