[packagekit] [PATCH] Spawn debconf-kde-frontend when KDE is running
Richard Hughes
hughsient at gmail.com
Thu Dec 9 09:22:10 PST 2010
On 8 December 2010 17:37, Matthias Klumpp <matthias at nlinux.org> wrote:
> /* close the socket */
> - ret = g_socket_close (priv->socket, error);
> - if (!ret)
> - goto out;
> + if (priv->socket) {
> + ret = g_socket_close (priv->socket, error);
> + if (!ret)
> + goto out;
If you're checking for a pointer, I usually do:
if (priv->socket != NULL)
This is a little clearer, as socket isn't actually a boolean.
> - /* stop watching for events */
> - if (priv->io_channel_socket_listen_id > 0)
> - g_source_remove (priv->io_channel_socket_listen_id);
> - if (priv->io_channel_child_stdout_listen_id > 0)
> - g_source_remove (priv->io_channel_child_stdout_listen_id);
> - if (priv->io_channel_child_stderr_listen_id > 0)
> - g_source_remove (priv->io_channel_child_stderr_listen_id);
> - if (priv->io_channel_child_stdin_listen_id > 0)
> - g_source_remove (priv->io_channel_child_stdin_listen_id);
> + /* stop watching for events */
> + if (priv->io_channel_socket_listen_id > 0)
> + g_source_remove (priv->io_channel_socket_listen_id);
> + if (priv->io_channel_child_stdout_listen_id > 0)
> + g_source_remove (priv->io_channel_child_stdout_listen_id);
> + if (priv->io_channel_child_stderr_listen_id > 0)
> + g_source_remove (priv->io_channel_child_stderr_listen_id);
> + if (priv->io_channel_child_stdin_listen_id > 0)
> + g_source_remove (priv->io_channel_child_stdin_listen_id);
> + }
>
> /* kill process */
> if (priv->child_pid > 0) {
> @@ -138,10 +140,15 @@ pk_client_helper_stop (PkClientHelper
> *client_helper, GError **error)
> }
> }
>
> + /* when we're here, everything worked fine */
> + ret = TRUE;
> +
> /* remove any socket file */
> - ret = g_file_delete (priv->socket_file, NULL, error);
> - if (!ret)
> - goto out;
> + if (g_file_query_exists (priv->socket_file, NULL)) {
> + ret = g_file_delete (priv->socket_file, NULL, error);
> + if (!ret)
> + goto out;
> + }
> out:
> return ret;
> }
> @@ -437,7 +444,10 @@ pk_client_helper_start (PkClientHelper
> *client_helper,
> gchar **argv, gchar **envp,
> GError **error)
> {
> + guint i;
> gboolean ret = FALSE;
> + gboolean use_debkonf = FALSE;
> + GError *error_local = NULL;
> + if (g_file_test ("/usr/bin/debkonf", G_FILE_TEST_EXISTS))
> + use_debkonf = TRUE;
I thought is wasn't called that anymore?
>
> /* cache for actual start */
> - priv->argv = g_strdupv (argv);
> priv->envp = g_strdupv (envp);
> + priv->argv = g_strdupv (argv);
Not needed.
Otherwise looks fine, thanks.
Richard.
More information about the PackageKit
mailing list