diff options
| author | Johan Hedberg <johan.hedberg@nokia.com> | 2009-02-25 15:20:40 +0200 | 
|---|---|---|
| committer | Johan Hedberg <johan.hedberg@nokia.com> | 2009-02-25 15:20:40 +0200 | 
| commit | c69555a4642e3d74a192c45500a0424bf0fa6ccc (patch) | |
| tree | f0b06760e65efe2e4191f503a0b81d860904c599 | |
| parent | f9b3cafb55f4cc9e7ea98bc3da98daca25598afb (diff) | |
Default to close_on_unref = TRUE to avoid descriptor leaks
| -rw-r--r-- | common/btio.c | 8 | 
1 files changed, 5 insertions, 3 deletions
diff --git a/common/btio.c b/common/btio.c index dbbc4287..9ff407fd 100644 --- a/common/btio.c +++ b/common/btio.c @@ -148,10 +148,8 @@ static gboolean connect_cb(GIOChannel *io, GIOCondition cond,  	conn->connect(io, gerr, conn->user_data); -	if (gerr) { -		g_io_channel_shutdown(io, FALSE, NULL); +	if (gerr)  		g_error_free(gerr); -	}  	return FALSE;  } @@ -177,6 +175,9 @@ static gboolean server_cb(GIOChannel *io, GIOCondition cond,  	cli_io = g_io_channel_unix_new(cli_sock); +	g_io_channel_set_close_on_unref(cli_io, TRUE); +	g_io_channel_set_flags(cli_io, G_IO_FLAG_NONBLOCK, NULL); +  	if (server->confirm)  		server->confirm(cli_io, server->user_data);  	else @@ -1138,6 +1139,7 @@ static GIOChannel *create_io(BtIOType type, gboolean server,  	io = g_io_channel_unix_new(sock); +	g_io_channel_set_close_on_unref(io, TRUE);  	g_io_channel_set_flags(io, G_IO_FLAG_NONBLOCK, NULL);  	return io;  | 
