[spice-common 7/7] log: Remove spice_backtrace()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It's causing issues with selinux. The same is achieved through
abrt/cores/...
---
 common/Makefile.am    |   2 -
 common/backtrace.c    | 135 --------------------------------------------------
 common/backtrace.h    |  34 -------------
 common/log.c          |   2 -
 common/spice_common.h |   1 -
 5 files changed, 174 deletions(-)
 delete mode 100644 common/backtrace.c
 delete mode 100644 common/backtrace.h

diff --git a/common/Makefile.am b/common/Makefile.am
index 7382509..264284f 100644
--- a/common/Makefile.am
+++ b/common/Makefile.am
@@ -18,8 +18,6 @@ BUILT_SOURCES = $(CLIENT_MARSHALLERS) $(SERVER_MARSHALLERS)
 
 noinst_LTLIBRARIES = libspice-common.la libspice-common-server.la libspice-common-client.la
 libspice_common_la_SOURCES =		\
-	backtrace.c			\
-	backtrace.h			\
 	bitops.h			\
 	canvas_utils.c			\
 	canvas_utils.h			\
diff --git a/common/backtrace.c b/common/backtrace.c
deleted file mode 100644
index 1b7fab3..0000000
--- a/common/backtrace.c
+++ /dev/null
@@ -1,135 +0,0 @@
-/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
-/*
-   Copyright (C) 2011 Red Hat, Inc.
-
-   This library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   This library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with this library; if not, see <http://www.gnu.org/licenses/>.
-*/
-
-/*
- * Taken from xserver os/backtrace.c:
- * Copyright (C) 2008 Red Hat, Inc.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <errno.h>
-#include <unistd.h>
-#include <sys/types.h>
-#ifndef __MINGW32__
-#include <sys/wait.h>
-#endif
-
-#include "spice_common.h"
-
-#define GSTACK_PATH "/usr/bin/gstack"
-
-#if HAVE_EXECINFO_H
-#include <execinfo.h>
-
-static void spice_backtrace_backtrace(void)
-{
-    void *array[100];
-    int size;
-
-    size = backtrace(array, sizeof(array)/sizeof(array[0]));
-    backtrace_symbols_fd(array, size, STDERR_FILENO);
-}
-#else
-static void spice_backtrace_backtrace(void)
-{
-}
-#endif
-
-/* XXX perhaps gstack can be available in windows but pipe/waitpid isn't,
- * so until it is ported properly just compile it out, we lose the
- * backtrace only. */
-#ifndef __MINGW32__
-static int spice_backtrace_gstack(void)
-{
-    pid_t kidpid;
-    int pipefd[2];
-
-    if (pipe(pipefd) != 0) {
-        return -1;
-    }
-
-    kidpid = fork();
-
-    if (kidpid == -1) {
-        /* ERROR */
-        return -1;
-    } else if (kidpid == 0) {
-        /* CHILD */
-        char parent[16];
-
-        close(STDIN_FILENO);
-        close(STDOUT_FILENO);
-        dup2(pipefd[1],STDOUT_FILENO);
-        close(STDERR_FILENO);
-
-        snprintf(parent, sizeof(parent), "%d", getppid());
-        execle(GSTACK_PATH, "gstack", parent, NULL, NULL);
-        exit(1);
-    } else {
-        /* PARENT */
-        char btline[256];
-        int kidstat;
-        int bytesread;
-        int done = 0;
-
-        close(pipefd[1]);
-
-        while (!done) {
-            bytesread = read(pipefd[0], btline, sizeof(btline) - 1);
-
-            if (bytesread > 0) {
-                btline[bytesread] = 0;
-                fprintf(stderr, "%s", btline);
-            }
-            else if ((bytesread == 0) ||
-                     ((errno != EINTR) && (errno != EAGAIN))) {
-                done = 1;
-            }
-        }
-        close(pipefd[0]);
-        waitpid(kidpid, &kidstat, 0);
-        if (kidstat != 0)
-            return -1;
-    }
-    return 0;
-}
-#else
-static int spice_backtrace_gstack(void)
-{
-    /* empty failing implementation */
-    return -1;
-}
-#endif
-
-void spice_backtrace(void)
-{
-    int ret = -1;
-
-    if (!access(GSTACK_PATH, X_OK)) {
-        ret = spice_backtrace_gstack();
-    }
-    if (ret != 0) {
-        spice_backtrace_backtrace();
-    }
-}
diff --git a/common/backtrace.h b/common/backtrace.h
deleted file mode 100644
index 894c027..0000000
--- a/common/backtrace.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
-/*
-   Copyright (C) 2011 Red Hat, Inc.
-
-   This library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   This library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with this library; if not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef BACKTRACE_H
-#define BACKTRACE_H
-
-#include <spice/macros.h>
-
-SPICE_BEGIN_DECLS
-
-#if defined(WIN32) && !defined(__MINGW32__)
-#define spice_backtrace()
-#else
-void spice_backtrace(void);
-#endif
-
-SPICE_END_DECLS
-
-#endif // BACKTRACE_H
diff --git a/common/log.c b/common/log.c
index 09894a6..aa3fabf 100644
--- a/common/log.c
+++ b/common/log.c
@@ -28,7 +28,6 @@
 #endif
 
 #include "log.h"
-#include "backtrace.h"
 
 static int debug_level = -1;
 static int abort_level = -1;
@@ -115,7 +114,6 @@ static void spice_logv(const char *log_domain,
     g_string_free(log_msg, TRUE);
 
     if (abort_level != -1 && abort_level >= (int) log_level) {
-        spice_backtrace();
         abort();
     }
 }
diff --git a/common/spice_common.h b/common/spice_common.h
index 5572326..8976f64 100644
--- a/common/spice_common.h
+++ b/common/spice_common.h
@@ -25,7 +25,6 @@
 #include <stddef.h>
 
 #include <spice/macros.h>
-#include "backtrace.h"
 #include "log.h"
 
 #ifdef SPICE_DISABLE_ABORT
-- 
2.5.0

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]