diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2013-11-27 08:38:01 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2013-11-27 08:38:01 +0000 |
commit | f8044f6042e2bfa9166f6d3684ec7abe70502f48 (patch) | |
tree | 93782ed6157d37d3087044fc0af31ebe518088b2 /src | |
parent | 69bcdd242aa2f60c727a477139f38036eab50e47 (diff) |
src/main.c: check the return value of fd_gets().
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@3303 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -1553,7 +1553,7 @@ static gint prohibit_duplicate_launch(void) } fd_write_all(sock, ".\n", 2); for (;;) { - fd_gets(sock, buf, sizeof(buf)); + if (fd_gets(sock, buf, sizeof(buf)) <= 0) break; if (!strncmp(buf, ".\n", 2)) break; fputs(buf, stdout); } @@ -1613,7 +1613,7 @@ static GPtrArray *get_folder_item_list(gint sock) GPtrArray *folders = NULL; for (;;) { - fd_gets(sock, buf, sizeof(buf)); + if (fd_gets(sock, buf, sizeof(buf)) <= 0) break; if (!strncmp(buf, ".\n", 2)) break; strretchomp(buf); if (!folders) folders = g_ptr_array_new(); @@ -1640,7 +1640,13 @@ static gboolean lock_socket_input_cb(GIOChannel *source, GIOCondition condition, fd = g_io_channel_unix_get_fd(source); sock = fd_accept(fd); - fd_gets(sock, buf, sizeof(buf)); + if (fd_gets(sock, buf, sizeof(buf)) <= 0) { + fd_close(sock); +#if USE_THREADS + gdk_threads_leave(); +#endif + return TRUE; + } if (!strncmp(buf, "popup", 5)) { #ifdef G_OS_WIN32 |