/*
* Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 2002-2012 by the Claws Mail Team
+ * Copyright (C) 2002-2015 by the Claws Mail Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
*/
#ifdef HAVE_CONFIG_H
int choutput[2];
pid_t pid;
- pipe(choutput);
+ if (pipe(choutput) == -1) {
+ g_print("can't pipe - error %s", g_strerror(errno));
+ return;
+ }
if (0 == (pid = fork())) {
char *argp[10];
char **argptr = argp;
gchar *filespec = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, DEBUGGERRC, NULL);
- setgid(getgid());
- setuid(getuid());
+ if (setgid(getgid()) != 0)
+ perror("setgid");
+ if (setuid(getuid()) != 0)
+ perror("setuid");
/*
* setup debugger to attach to crashed claws
* redirect output to write end of pipe
*/
close(1);
- dup(choutput[1]);
+ if (dup(choutput[1]) < 0)
+ perror("dup");
close(choutput[0]);
if (-1 == execvp("gdb", argp))
g_print("error execvp\n");
args[3] = buf;
args[4] = NULL;
- chdir(claws_get_startup_dir());
- setgid(getgid());
- setuid(getuid());
+ if (chdir(claws_get_startup_dir()) != 0)
+ perror("chdir");
+ if (setgid(getgid()) != 0)
+ perror("setgid");
+ if (setuid(getuid()) != 0 )
+ perror("setuid");
execvp(argv0, args);
} else {
waitpid(pid, NULL, 0);