diff options
author | Denys Vlasenko <dvlasenk@redhat.com> | 2010-09-07 13:32:39 +0200 |
---|---|---|
committer | Denys Vlasenko <dvlasenk@redhat.com> | 2010-09-07 13:32:39 +0200 |
commit | cbd686eb63dd2f37f2d53641fcd565ff4ac6900e (patch) | |
tree | 33bef76758950f54515ffdfca16aaee035fd03be /src | |
parent | f85dfd89a51f665c8e54a928cbbf0668c7defdb4 (diff) | |
download | abrt-cbd686eb63dd2f37f2d53641fcd565ff4ac6900e.tar.gz abrt-cbd686eb63dd2f37f2d53641fcd565ff4ac6900e.tar.xz abrt-cbd686eb63dd2f37f2d53641fcd565ff4ac6900e.zip |
dumpsocket: removed unused sockaddr param in accept() call; s/perror/error/
Also removed unneeded casts and added and fixed comments
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/daemon/Daemon.cpp | 2 | ||||
-rw-r--r-- | src/daemon/dumpsocket.cpp | 14 | ||||
-rw-r--r-- | src/daemon/dumpsocket.h | 2 |
3 files changed, 8 insertions, 10 deletions
diff --git a/src/daemon/Daemon.cpp b/src/daemon/Daemon.cpp index ac845b1f..7c7fed2b 100644 --- a/src/daemon/Daemon.cpp +++ b/src/daemon/Daemon.cpp @@ -856,7 +856,6 @@ int main(int argc, char** argv) VERB1 log("Creating glib main loop"); pMainloop = g_main_loop_new(NULL, FALSE); - /* Watching DEBUG_DUMPS_DIR for new files... */ VERB1 log("Initializing inotify"); sanitize_dump_dir_rights(); @@ -865,6 +864,7 @@ int main(int argc, char** argv) if (inotify_fd == -1) perror_msg_and_die("inotify_init failed"); close_on_exec_on(inotify_fd); + /* Watching DEBUG_DUMPS_DIR for new files... */ if (inotify_add_watch(inotify_fd, DEBUG_DUMPS_DIR, IN_CREATE | IN_MOVED_TO) < 0) perror_msg_and_die("inotify_add_watch failed on '%s'", DEBUG_DUMPS_DIR); if (!g_settings_sWatchCrashdumpArchiveDir.empty()) diff --git a/src/daemon/dumpsocket.cpp b/src/daemon/dumpsocket.cpp index c72e3661..21944d90 100644 --- a/src/daemon/dumpsocket.cpp +++ b/src/daemon/dumpsocket.cpp @@ -21,7 +21,7 @@ #include "dumpsocket.h" #include "debug_dump.h" #include "crash_types.h" -#include "abrt_exception.h" +//#include "abrt_exception.h" #include "hooklib.h" #define SOCKET_FILE VAR_RUN"/abrt/abrt.socket" @@ -209,6 +209,7 @@ static void create_debug_dump(struct client *client) client->analyzer, client->pid, path); /* Handle free space checking. */ +//FIXME! needs to use globals, like the rest of daemon does! unsigned maxCrashReportsSize = 0; parse_conf(NULL, &maxCrashReportsSize, NULL, NULL); if (maxCrashReportsSize > 0) @@ -454,7 +455,7 @@ static struct client *client_new(int socket) if (0 != getsockopt(socket, SOL_SOCKET, SO_PEERCRED, &cr, &crlen)) perror_msg_and_die("dumpsocket: Failed to get client uid"); if (crlen != sizeof(struct ucred)) - perror_msg_and_die("dumpsocket: Failed to get client uid (crlen)"); + error_msg_and_die("dumpsocket: Failed to get client uid (crlen)"); client->uid = cr.uid; client->messagebuf = g_byte_array_new(); @@ -484,7 +485,7 @@ static struct client *client_new(int socket) /* Register client callback. */ client->socket_id = g_io_add_watch(client->channel, (GIOCondition)(G_IO_IN | G_IO_PRI | G_IO_ERR | G_IO_HUP | G_IO_NVAL), - (GIOFunc)client_socket_cb, + client_socket_cb, client); if (!client->socket_id) error_msg_and_die("dumpsocket: Can't add client socket watch"); @@ -510,10 +511,7 @@ static gboolean server_socket_cb(GIOChannel *source, return TRUE; } - struct sockaddr_un remote; - socklen_t len = sizeof(remote); - int socket = accept(g_io_channel_unix_get_fd(source), - (struct sockaddr*)&remote, &len); + int socket = accept(g_io_channel_unix_get_fd(source), NULL, NULL); if (socket == -1) { perror_msg("dumpsocket: Server can not accept client"); @@ -547,7 +545,7 @@ void dumpsocket_init() g_io_channel_set_close_on_unref(channel, TRUE); channel_cb_id = g_io_add_watch(channel, (GIOCondition)(G_IO_IN | G_IO_PRI), - (GIOFunc)server_socket_cb, + server_socket_cb, NULL); if (!channel_cb_id) perror_msg_and_die("dumpsocket: Can't add socket watch"); diff --git a/src/daemon/dumpsocket.h b/src/daemon/dumpsocket.h index e5b79d60..88fe2446 100644 --- a/src/daemon/dumpsocket.h +++ b/src/daemon/dumpsocket.h @@ -22,7 +22,7 @@ Unix socket in ABRT daemon for creating new dump directories. Why to use socket for creating dump dirs? Security. When a Python -script throwns unexpected exception, ABRT handler catches it, running +script throws unexpected exception, ABRT handler catches it, running as a part of that broken Python application. The application is running with certain SELinux privileges, for example it can not execute other programs, or to create files in /var/cache or anything else required |