summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Ancell <robert.ancell@canonical.com>2017-12-21 14:45:14 +1300
committerRobert Ancell <robert.ancell@canonical.com>2017-12-21 14:45:14 +1300
commit4eae3aaf2c411f4608b1ebbeb9299d9a54ca44ef (patch)
treea989797b9a67593229676112764447a60e512b74
parenta4e5115642813ca34e37b8a2f8b9e7892b949281 (diff)
downloadaccountsservice-4eae3aaf2c411f4608b1ebbeb9299d9a54ca44ef.tar.gz
Remove some unneeded variable initialization after g_auto refactoring
-rw-r--r--src/daemon.c7
-rw-r--r--src/libaccountsservice/act-user-manager.c5
-rw-r--r--src/user.c11
-rw-r--r--src/util.c1
4 files changed, 2 insertions, 22 deletions
diff --git a/src/daemon.c b/src/daemon.c
index 7bd7502..169f20f 100644
--- a/src/daemon.c
+++ b/src/daemon.c
@@ -1091,7 +1091,6 @@ daemon_create_user_authorized_cb (Daemon *daemon,
return;
}
- error = NULL;
if (!spawn_with_login_uid (context, argv, &error)) {
throw_error (context, ERROR_FAILED, "running '%s' failed: %s", argv[0], error->message);
return;
@@ -1288,7 +1287,6 @@ daemon_delete_user_authorized_cb (Daemon *daemon,
argv[4] = NULL;
}
- error = NULL;
if (!spawn_with_login_uid (context, argv, &error)) {
throw_error (context, ERROR_FAILED, "running '%s' failed: %s", argv[0], error->message);
return;
@@ -1359,11 +1357,8 @@ check_auth_cb (PolkitAuthority *authority,
CheckAuthData *cad = data;
PolkitAuthorizationResult *result;
g_autoptr(GError) error = NULL;
- gboolean is_authorized;
+ gboolean is_authorized = FALSE;
- is_authorized = FALSE;
-
- error = NULL;
result = polkit_authority_check_authorization_finish (authority, res, &error);
if (error) {
throw_error (cad->context, ERROR_PERMISSION_DENIED, "Not authorized: %s", error->message);
diff --git a/src/libaccountsservice/act-user-manager.c b/src/libaccountsservice/act-user-manager.c
index 4f794a5..3c9ccac 100644
--- a/src/libaccountsservice/act-user-manager.c
+++ b/src/libaccountsservice/act-user-manager.c
@@ -2824,7 +2824,6 @@ act_user_manager_init (ActUserManager *manager)
NULL,
g_object_unref);
- error = NULL;
manager->priv->connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
if (manager->priv->connection == NULL) {
if (error != NULL) {
@@ -3269,7 +3268,6 @@ act_user_manager_uncache_user (ActUserManager *manager,
g_assert (manager->priv->accounts_proxy != NULL);
- local_error = NULL;
res = accounts_accounts_call_uncache_user_sync (manager->priv->accounts_proxy,
username,
NULL,
@@ -3380,7 +3378,7 @@ act_user_manager_delete_user (ActUserManager *manager,
gboolean remove_files,
GError **error)
{
- GError *local_error;
+ GError *local_error = NULL;
g_debug ("ActUserManager: Deleting user '%s' (uid %ld)", act_user_get_user_name (user), (long) act_user_get_uid (user));
@@ -3388,7 +3386,6 @@ act_user_manager_delete_user (ActUserManager *manager,
g_return_val_if_fail (ACT_IS_USER (user), FALSE);
g_return_val_if_fail (manager->priv->accounts_proxy != NULL, FALSE);
- local_error = NULL;
if (!accounts_accounts_call_delete_user_sync (manager->priv->accounts_proxy,
act_user_get_uid (user),
remove_files,
diff --git a/src/user.c b/src/user.c
index c75731e..0dee26c 100644
--- a/src/user.c
+++ b/src/user.c
@@ -426,7 +426,6 @@ save_extra_data (User *user)
user_save_to_keyfile (user, user->keyfile);
- error = NULL;
data = g_key_file_to_data (user->keyfile, NULL, &error);
if (data == NULL) {
g_warning ("Saving data for user %s failed: %s",
@@ -942,7 +941,6 @@ user_change_user_name_authorized_cb (Daemon *daemon,
argv[4] = user->user_name;
argv[5] = NULL;
- error = NULL;
if (!spawn_with_login_uid (context, argv, &error)) {
throw_error (context, ERROR_FAILED, "running '%s' failed: %s", argv[0], error->message);
return;
@@ -1272,7 +1270,6 @@ user_change_home_dir_authorized_cb (Daemon *daemon,
argv[5] = user->user_name;
argv[6] = NULL;
- error = NULL;
if (!spawn_with_login_uid (context, argv, &error)) {
throw_error (context, ERROR_FAILED, "running '%s' failed: %s", argv[0], error->message);
return;
@@ -1332,7 +1329,6 @@ user_change_shell_authorized_cb (Daemon *daemon,
argv[4] = user->user_name;
argv[5] = NULL;
- error = NULL;
if (!spawn_with_login_uid (context, argv, &error)) {
throw_error (context, ERROR_FAILED, "running '%s' failed: %s", argv[0], error->message);
return;
@@ -1471,7 +1467,6 @@ user_change_icon_file_authorized_cb (Daemon *daemon,
pw = getpwuid (uid);
- error = NULL;
if (!g_spawn_async_with_pipes (NULL, (gchar**)argv, NULL, 0, become_user, pw, NULL, NULL, &std_out, NULL, &error)) {
throw_error (context, ERROR_FAILED, "reading file '%s' failed: %s", filename, error->message);
return;
@@ -1479,7 +1474,6 @@ user_change_icon_file_authorized_cb (Daemon *daemon,
input = g_unix_input_stream_new (std_out, FALSE);
- error = NULL;
bytes = g_output_stream_splice (output, input, G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET, NULL, &error);
if (bytes < 0 || (gsize)bytes != size) {
throw_error (context, ERROR_FAILED, "copying file '%s' to '%s' failed: %s", filename, dest_path, error ? error->message : "unknown reason");
@@ -1556,7 +1550,6 @@ user_change_locked_authorized_cb (Daemon *daemon,
argv[3] = user->user_name;
argv[4] = NULL;
- error = NULL;
if (!spawn_with_login_uid (context, argv, &error)) {
throw_error (context, ERROR_FAILED, "running '%s' failed: %s", argv[0], error->message);
return;
@@ -1746,7 +1739,6 @@ user_change_password_mode_authorized_cb (Daemon *daemon,
argv[3] = user->user_name;
argv[4] = NULL;
- error = NULL;
if (!spawn_with_login_uid (context, argv, &error)) {
throw_error (context, ERROR_FAILED, "running '%s' failed: %s", argv[0], error->message);
return;
@@ -1760,7 +1752,6 @@ user_change_password_mode_authorized_cb (Daemon *daemon,
argv[4] = user->user_name;
argv[5] = NULL;
- error = NULL;
if (!spawn_with_login_uid (context, argv, &error)) {
throw_error (context, ERROR_FAILED, "running '%s' failed: %s", argv[0], error->message);
return;
@@ -1787,7 +1778,6 @@ user_change_password_mode_authorized_cb (Daemon *daemon,
argv[3] = user->user_name;
argv[4] = NULL;
- error = NULL;
if (!spawn_with_login_uid (context, argv, &error)) {
throw_error (context, ERROR_FAILED, "running '%s' failed: %s", argv[0], error->message);
return;
@@ -1871,7 +1861,6 @@ user_change_password_authorized_cb (Daemon *daemon,
argv[4] = user->user_name;
argv[5] = NULL;
- error = NULL;
if (!spawn_with_login_uid (context, argv, &error)) {
throw_error (context, ERROR_FAILED, "running '%s' failed: %s", argv[0], error->message);
return;
diff --git a/src/util.c b/src/util.c
index 9cdd878..0372b4b 100644
--- a/src/util.c
+++ b/src/util.c
@@ -265,7 +265,6 @@ get_caller_uid (GDBusMethodInvocation *context,
g_autoptr(GVariant) reply = NULL;
g_autoptr(GError) error = NULL;
- error = NULL;
reply = g_dbus_connection_call_sync (g_dbus_method_invocation_get_connection (context),
"org.freedesktop.DBus",
"/org/freedesktop/DBus",