diff --git a/src/lib/blockdev.c.in b/src/lib/blockdev.c.in index f8f86ce41..967dca065 100644 --- a/src/lib/blockdev.c.in +++ b/src/lib/blockdev.c.in @@ -442,8 +442,8 @@ gboolean bd_init (BDPluginSpec **require_plugins, BDUtilsLogFunc log_func, GErro } if (!load_plugins (require_plugins, FALSE, &num_loaded)) { - g_set_error (error, BD_INIT_ERROR, BD_INIT_ERROR_PLUGINS_FAILED, - "Failed to load plugins"); + g_set_error_literal (error, BD_INIT_ERROR, BD_INIT_ERROR_PLUGINS_FAILED, + "Failed to load plugins"); success = FALSE; } @@ -518,8 +518,8 @@ gboolean bd_ensure_init (BDPluginSpec **require_plugins, BDUtilsLogFunc log_func } if (!load_plugins (require_plugins, FALSE, &num_loaded)) { - g_set_error (error, BD_INIT_ERROR, BD_INIT_ERROR_PLUGINS_FAILED, - "Failed to load plugins"); + g_set_error_literal (error, BD_INIT_ERROR, BD_INIT_ERROR_PLUGINS_FAILED, + "Failed to load plugins"); success = FALSE; } @@ -622,8 +622,8 @@ gboolean bd_reinit (BDPluginSpec **require_plugins, gboolean reload, BDUtilsLogF } if (!load_plugins (require_plugins, reload, &num_loaded)) { - g_set_error (error, BD_INIT_ERROR, BD_INIT_ERROR_PLUGINS_FAILED, - "Failed to load plugins"); + g_set_error_literal (error, BD_INIT_ERROR, BD_INIT_ERROR_PLUGINS_FAILED, + "Failed to load plugins"); success = FALSE; } else if (require_plugins && (*require_plugins == NULL) && reload) diff --git a/src/plugins/btrfs.c b/src/plugins/btrfs.c index 258ae1c4a..5040abdf2 100644 --- a/src/plugins/btrfs.c +++ b/src/plugins/btrfs.c @@ -285,7 +285,7 @@ gboolean bd_btrfs_create_volume (const gchar **devices, const gchar *label, cons return FALSE; if (!devices || (g_strv_length ((gchar **) devices) < 1)) { - g_set_error (error, BD_BTRFS_ERROR, BD_BTRFS_ERROR_DEVICE, "No devices given"); + g_set_error_literal (error, BD_BTRFS_ERROR, BD_BTRFS_ERROR_DEVICE, "No devices given"); return FALSE; } @@ -480,7 +480,7 @@ guint64 bd_btrfs_get_default_subvolume_id (const gchar *mountpoint, GError **err success = g_regex_match (regex, output, 0, &match_info); if (!success) { - g_set_error (error, BD_BTRFS_ERROR, BD_BTRFS_ERROR_PARSE, "Failed to parse subvolume's ID"); + g_set_error_literal (error, BD_BTRFS_ERROR, BD_BTRFS_ERROR_PARSE, "Failed to parse subvolume's ID"); g_regex_unref (regex); g_match_info_free (match_info); g_free (output); @@ -619,7 +619,7 @@ BDBtrfsDeviceInfo** bd_btrfs_list_devices (const gchar *device, GError **error) g_regex_unref (regex); if (dev_infos->len == 0) { - g_set_error (error, BD_BTRFS_ERROR, BD_BTRFS_ERROR_PARSE, "Failed to parse information about devices"); + g_set_error_literal (error, BD_BTRFS_ERROR, BD_BTRFS_ERROR_PARSE, "Failed to parse information about devices"); g_ptr_array_free (dev_infos, TRUE); return NULL; } @@ -712,7 +712,7 @@ BDBtrfsSubvolumeInfo** bd_btrfs_list_subvolumes (const gchar *mountpoint, gboole g_regex_unref (regex); if (subvol_infos->len == 0) { - g_set_error (error, BD_BTRFS_ERROR, BD_BTRFS_ERROR_PARSE, "Failed to parse information about subvolumes"); + g_set_error_literal (error, BD_BTRFS_ERROR, BD_BTRFS_ERROR_PARSE, "Failed to parse information about subvolumes"); g_ptr_array_free (subvol_infos, TRUE); return NULL; } diff --git a/src/plugins/crypto.c b/src/plugins/crypto.c index e65b532ad..0968d5090 100644 --- a/src/plugins/crypto.c +++ b/src/plugins/crypto.c @@ -383,84 +383,84 @@ gboolean bd_crypto_is_tech_avail (BDCryptoTech tech, guint64 mode, GError **erro BD_CRYPTO_TECH_MODE_ADD_KEY|BD_CRYPTO_TECH_MODE_REMOVE_KEY|BD_CRYPTO_TECH_MODE_RESIZE| BD_CRYPTO_TECH_MODE_SUSPEND_RESUME|BD_CRYPTO_TECH_MODE_BACKUP_RESTORE); if (ret != mode) { - g_set_error (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_TECH_UNAVAIL, - "Only 'create', 'open', 'query', 'add-key', 'remove-key', 'resize', 'suspend-resume', 'backup-restore' supported for LUKS"); + g_set_error_literal (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_TECH_UNAVAIL, + "Only 'create', 'open', 'query', 'add-key', 'remove-key', 'resize', 'suspend-resume', 'backup-restore' supported for LUKS"); return FALSE; } else return TRUE; case BD_CRYPTO_TECH_TRUECRYPT: ret = mode & BD_CRYPTO_TECH_MODE_OPEN_CLOSE; if (ret != mode) { - g_set_error (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_TECH_UNAVAIL, - "Only 'open' supported for TrueCrypt"); + g_set_error_literal (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_TECH_UNAVAIL, + "Only 'open' supported for TrueCrypt"); return FALSE; } else return TRUE; case BD_CRYPTO_TECH_ESCROW: #ifndef WITH_BD_ESCROW - g_set_error (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_TECH_UNAVAIL, - "Escrow technology is not available, libblockdev has been compiled without escrow support."); + g_set_error_literal (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_TECH_UNAVAIL, + "Escrow technology is not available, libblockdev has been compiled without escrow support."); return FALSE; #endif ret = mode & BD_CRYPTO_TECH_MODE_CREATE; if (ret != mode) { - g_set_error (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_TECH_UNAVAIL, - "Only 'create' supported for device escrow"); + g_set_error_literal (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_TECH_UNAVAIL, + "Only 'create' supported for device escrow"); return FALSE; } else return TRUE; case BD_CRYPTO_TECH_INTEGRITY: ret = mode & (BD_CRYPTO_TECH_MODE_CREATE|BD_CRYPTO_TECH_MODE_OPEN_CLOSE|BD_CRYPTO_TECH_MODE_QUERY); if (ret != mode) { - g_set_error (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_TECH_UNAVAIL, - "Only 'create', 'open' and 'query' supported for Integrity"); + g_set_error_literal (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_TECH_UNAVAIL, + "Only 'create', 'open' and 'query' supported for Integrity"); return FALSE; } else return TRUE; case BD_CRYPTO_TECH_BITLK: ret = mode & (BD_CRYPTO_TECH_MODE_OPEN_CLOSE|BD_CRYPTO_TECH_MODE_QUERY); if (ret != mode) { - g_set_error (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_TECH_UNAVAIL, - "Only 'open' and 'query' supported for BITLK"); + g_set_error_literal (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_TECH_UNAVAIL, + "Only 'open' and 'query' supported for BITLK"); return FALSE; } else return TRUE; case BD_CRYPTO_TECH_KEYRING: ret = mode & BD_CRYPTO_TECH_MODE_ADD_KEY; if (ret != mode) { - g_set_error (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_TECH_UNAVAIL, - "Only 'add key' supported for kernel keyring"); + g_set_error_literal (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_TECH_UNAVAIL, + "Only 'add key' supported for kernel keyring"); return FALSE; } else return TRUE; case BD_CRYPTO_TECH_FVAULT2: #ifndef LIBCRYPTSETUP_26 - g_set_error (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_TECH_UNAVAIL, - "FVAULT2 technology requires libcryptsetup >= 2.6.0"); + g_set_error_literal (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_TECH_UNAVAIL, + "FVAULT2 technology requires libcryptsetup >= 2.6.0"); return FALSE; #endif ret = mode & BD_CRYPTO_TECH_MODE_OPEN_CLOSE; if (ret != mode) { - g_set_error (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_TECH_UNAVAIL, - "Only 'open' supported for FVAULT2"); + g_set_error_literal (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_TECH_UNAVAIL, + "Only 'open' supported for FVAULT2"); return FALSE; } else return TRUE; case BD_CRYPTO_TECH_SED_OPAL: #if !defined(LIBCRYPTSETUP_27) || !defined(HAVE_LINUX_OPAL) - g_set_error (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_TECH_UNAVAIL, - "OPAL technology requires libcryptsetup >= 2.7.0 and kernel with SED OPAL support"); + g_set_error_literal (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_TECH_UNAVAIL, + "OPAL technology requires libcryptsetup >= 2.7.0 and kernel with SED OPAL support"); return FALSE; #endif ret = mode & (BD_CRYPTO_TECH_MODE_CREATE|BD_CRYPTO_TECH_MODE_QUERY|BD_CRYPTO_TECH_MODE_MODIFY); if (ret != mode) { - g_set_error (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_TECH_UNAVAIL, - "Only 'create', 'query' and 'modify' supported for OPAL"); + g_set_error_literal (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_TECH_UNAVAIL, + "Only 'create', 'query' and 'modify' supported for OPAL"); return FALSE; } else return TRUE; default: - g_set_error (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_TECH_UNAVAIL, "Unknown technology"); + g_set_error_literal (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_TECH_UNAVAIL, "Unknown technology"); return FALSE; } @@ -525,8 +525,8 @@ gboolean bd_crypto_device_is_luks (const gchar *device, GError **error) { probe = blkid_new_probe (); if (!probe) { - g_set_error (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_DEVICE, - "Failed to create a new probe"); + g_set_error_literal (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_DEVICE, + "Failed to create a new probe"); return FALSE; } @@ -656,8 +656,8 @@ const gchar* bd_crypto_luks_status (const gchar *luks_device, GError **error) { break; default: ret = NULL; - g_set_error (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_STATE, - "Unknown device's state"); + g_set_error_literal (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_STATE, + "Unknown device's state"); } crypt_free (cd); @@ -680,8 +680,8 @@ static struct crypt_pbkdf_type *get_pbkdf_params (BDCryptoLUKSPBKDF *user_pbkdf, */ default_pbkdf = crypt_get_pbkdf_default (CRYPT_LUKS2); if (!default_pbkdf) { - g_set_error (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_FORMAT_FAILED, - "Failed to get default values for pbkdf."); + g_set_error_literal (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_FORMAT_FAILED, + "Failed to get default values for pbkdf."); return NULL; } @@ -827,8 +827,8 @@ BDCryptoKeyslotContext* bd_crypto_keyslot_context_new_passphrase (const guint8 * BDCryptoKeyslotContext *context = NULL; if (!pass_data || data_len == 0) { - g_set_error (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_NO_KEY, - "No passphrase specified."); + g_set_error_literal (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_NO_KEY, + "No passphrase specified."); return NULL; } @@ -910,8 +910,8 @@ BDCryptoKeyslotContext* bd_crypto_keyslot_context_new_volume_key (const guint8 * BDCryptoKeyslotContext *context = NULL; if (!volume_key || volume_key_size == 0) { - g_set_error (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_NO_KEY, - "No volume key specified."); + g_set_error_literal (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_NO_KEY, + "No volume key specified."); return NULL; } @@ -973,8 +973,8 @@ gboolean _crypto_luks_format (const gchar *device, else if (luks_version == BD_CRYPTO_LUKS_VERSION_LUKS2) crypt_version = CRYPT_LUKS2; else { - g_set_error (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_TECH_UNAVAIL, - "Unknown or unsupported LUKS version specified"); + g_set_error_literal (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_TECH_UNAVAIL, + "Unknown or unsupported LUKS version specified"); bd_utils_report_finished (progress_id, l_error->message); g_propagate_error (error, l_error); return FALSE; @@ -1031,8 +1031,8 @@ gboolean _crypto_luks_format (const gchar *device, } close (dev_random_fd); } else { - g_set_error (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_FORMAT_FAILED, - "Failed to check random data entropy level"); + g_set_error_literal (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_FORMAT_FAILED, + "Failed to check random data entropy level"); crypt_free (cd); g_strfreev (cipher_specs); bd_utils_report_finished (progress_id, l_error->message); @@ -1047,8 +1047,8 @@ gboolean _crypto_luks_format (const gchar *device, opal_params.admin_key = (char *) opal_context->u.passphrase.pass_data; opal_params.admin_key_size = opal_context->u.passphrase.data_len; } else { - g_set_error (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_INVALID_CONTEXT, - "Only 'passphrase' context type is valid for OPAL format."); + g_set_error_literal (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_INVALID_CONTEXT, + "Only 'passphrase' context type is valid for OPAL format."); bd_utils_report_finished (progress_id, l_error->message); g_propagate_error (error, l_error); crypt_free (cd); @@ -1074,9 +1074,9 @@ gboolean _crypto_luks_format (const gchar *device, if (luks_version == BD_CRYPTO_LUKS_VERSION_LUKS1) { if (extra->integrity || extra->sector_size || extra->label || extra->subsystem) { - g_set_error (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_INVALID_PARAMS, - "Invalid extra arguments specified. Only `data_alignment`" - "and `data_device` are valid for LUKS 1."); + g_set_error_literal (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_INVALID_PARAMS, + "Invalid extra arguments specified. Only `data_alignment`" + "and `data_device` are valid for LUKS 1."); crypt_free (cd); g_strfreev (cipher_specs); bd_utils_report_finished (progress_id, l_error->message); @@ -1086,8 +1086,8 @@ gboolean _crypto_luks_format (const gchar *device, if (extra->pbkdf) { if (g_strcmp0 (extra->pbkdf->type, "pbkdf2") != 0) { - g_set_error (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_INVALID_PARAMS, - "Invalid pbkdf specified. Only `pbkdf2` is valid for LUKS 1."); + g_set_error_literal (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_INVALID_PARAMS, + "Invalid pbkdf specified. Only `pbkdf2` is valid for LUKS 1."); crypt_free (cd); g_strfreev (cipher_specs); bd_utils_report_finished (progress_id, l_error->message); @@ -1208,8 +1208,8 @@ gboolean _crypto_luks_format (const gchar *device, } bd_utils_report_progress (progress_id, 100, "Added key"); } else { - g_set_error (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_INVALID_CONTEXT, - "Only 'passphrase' and 'key file' context types are valid for LUKS format."); + g_set_error_literal (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_INVALID_CONTEXT, + "Only 'passphrase' and 'key file' context types are valid for LUKS format."); bd_utils_report_finished (progress_id, l_error->message); g_propagate_error (error, l_error); crypt_free (cd); @@ -1251,14 +1251,14 @@ gboolean bd_crypto_luks_format (const gchar *device, const gchar *cipher, guint6 static gboolean _is_dm_name_valid (const gchar *name, GError **error) { if (strlen (name) >= 128) { - g_set_error (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_INVALID_PARAMS, - "Device name can be at most 127 characters long."); + g_set_error_literal (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_INVALID_PARAMS, + "Device name can be at most 127 characters long."); return FALSE; } if (strchr (name, '/')) { - g_set_error (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_INVALID_PARAMS, - "Device name cannot contain '/' character."); + g_set_error_literal (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_INVALID_PARAMS, + "Device name cannot contain '/' character."); return FALSE; } @@ -1350,8 +1350,8 @@ gboolean bd_crypto_luks_open_flags (const gchar *device, const gchar *name, BDCr } else if (context->type == BD_CRYPTO_KEYSLOT_CONTEXT_TYPE_KEYRING) ret = crypt_activate_by_keyring (cd, name, context->u.keyring.key_desc, CRYPT_ANY_SLOT, crypt_flags); else { - g_set_error (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_INVALID_CONTEXT, - "Only 'passphrase', 'key file' and 'keyring' context types are valid for LUKS open."); + g_set_error_literal (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_INVALID_CONTEXT, + "Only 'passphrase', 'key file' and 'keyring' context types are valid for LUKS open."); bd_utils_report_finished (progress_id, l_error->message); g_propagate_error (error, l_error); crypt_free (cd); @@ -1360,11 +1360,11 @@ gboolean bd_crypto_luks_open_flags (const gchar *device, const gchar *name, BDCr if (ret < 0) { if (ret == -EPERM) - g_set_error (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_DEVICE, - "Failed to activate device: Incorrect passphrase."); + g_set_error_literal (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_DEVICE, + "Failed to activate device: Incorrect passphrase."); else if (ret == -ETXTBSY) - g_set_error (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_DEVICE, - "Failed to activate device: Unknown or unsupported LUKS2 requirements detected."); + g_set_error_literal (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_DEVICE, + "Failed to activate device: Unknown or unsupported LUKS2 requirements detected."); else g_set_error (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_DEVICE, "Failed to activate device: %s", strerror_l (-ret, c_locale)); @@ -1519,8 +1519,8 @@ gboolean bd_crypto_luks_add_key (const gchar *device, BDCryptoKeyslotContext *co key_buf = (char *) context->u.passphrase.pass_data; buf_len = context->u.passphrase.data_len; } else { - g_set_error (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_INVALID_CONTEXT, - "Only 'passphrase' and 'key file' context types are valid for LUKS add key."); + g_set_error_literal (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_INVALID_CONTEXT, + "Only 'passphrase' and 'key file' context types are valid for LUKS add key."); bd_utils_report_finished (progress_id, l_error->message); g_propagate_error (error, l_error); crypt_free (cd); @@ -1545,8 +1545,8 @@ gboolean bd_crypto_luks_add_key (const gchar *device, BDCryptoKeyslotContext *co nkey_buf = (char *) ncontext->u.passphrase.pass_data; nbuf_len = ncontext->u.passphrase.data_len; } else { - g_set_error (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_INVALID_CONTEXT, - "Only 'passphrase' and 'key file' context types are valid for LUKS add key."); + g_set_error_literal (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_INVALID_CONTEXT, + "Only 'passphrase' and 'key file' context types are valid for LUKS add key."); if (context->type == BD_CRYPTO_KEYSLOT_CONTEXT_TYPE_KEYFILE) crypt_safe_free (key_buf); bd_utils_report_finished (progress_id, l_error->message); @@ -1637,8 +1637,8 @@ gboolean bd_crypto_luks_remove_key (const gchar *device, BDCryptoKeyslotContext ret = crypt_activate_by_passphrase (cd, NULL, CRYPT_ANY_SLOT, key_buf, buf_len, 0); crypt_safe_free (key_buf); } else { - g_set_error (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_INVALID_CONTEXT, - "Only 'passphrase' and 'key file' context types are valid for LUKS remove key."); + g_set_error_literal (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_INVALID_CONTEXT, + "Only 'passphrase' and 'key file' context types are valid for LUKS remove key."); bd_utils_report_finished (progress_id, l_error->message); g_propagate_error (error, l_error); crypt_free (cd); @@ -1732,8 +1732,8 @@ gboolean bd_crypto_luks_change_key (const gchar *device, BDCryptoKeyslotContext key_buf = (char *) context->u.passphrase.pass_data; buf_len = context->u.passphrase.data_len; } else { - g_set_error (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_INVALID_CONTEXT, - "Only 'passphrase' and 'key file' context types are valid for LUKS change key."); + g_set_error_literal (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_INVALID_CONTEXT, + "Only 'passphrase' and 'key file' context types are valid for LUKS change key."); bd_utils_report_finished (progress_id, l_error->message); g_propagate_error (error, l_error); crypt_free (cd); @@ -1758,8 +1758,8 @@ gboolean bd_crypto_luks_change_key (const gchar *device, BDCryptoKeyslotContext nkey_buf = (char *) ncontext->u.passphrase.pass_data; nbuf_len = ncontext->u.passphrase.data_len; } else { - g_set_error (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_INVALID_CONTEXT, - "Only 'passphrase' and 'key file' context types are valid for LUKS change key."); + g_set_error_literal (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_INVALID_CONTEXT, + "Only 'passphrase' and 'key file' context types are valid for LUKS change key."); if (context->type == BD_CRYPTO_KEYSLOT_CONTEXT_TYPE_KEYFILE) crypt_safe_free (key_buf); bd_utils_report_finished (progress_id, l_error->message); @@ -1779,8 +1779,8 @@ gboolean bd_crypto_luks_change_key (const gchar *device, BDCryptoKeyslotContext if (ret < 0) { if (ret == -EPERM) - g_set_error (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_DEVICE, - "Failed to change the passphrase: No keyslot with given passphrase found."); + g_set_error_literal (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_DEVICE, + "Failed to change the passphrase: No keyslot with given passphrase found."); else g_set_error (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_ADD_KEY, "Failed to change the passphrase: %s", strerror_l (-ret, c_locale)); @@ -1865,8 +1865,8 @@ gboolean bd_crypto_luks_resize (const gchar *luks_device, guint64 size, BDCrypto cad.flags & CRYPT_ACTIVATE_KEYRING_KEY); crypt_safe_free (key_buffer); } else { - g_set_error (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_INVALID_CONTEXT, - "Only 'passphrase' and 'key file' context types are valid for LUKS resize."); + g_set_error_literal (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_INVALID_CONTEXT, + "Only 'passphrase' and 'key file' context types are valid for LUKS resize."); bd_utils_report_finished (progress_id, l_error->message); g_propagate_error (error, l_error); crypt_free (cd); @@ -1875,8 +1875,8 @@ gboolean bd_crypto_luks_resize (const gchar *luks_device, guint64 size, BDCrypto if (ret < 0) { if (ret == -EPERM) - g_set_error (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_DEVICE, - "Failed to activate device: Incorrect passphrase."); + g_set_error_literal (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_DEVICE, + "Failed to activate device: Incorrect passphrase."); else g_set_error (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_DEVICE, "Failed to activate device: %s", strerror_l (-ret, c_locale)); @@ -1890,10 +1890,10 @@ gboolean bd_crypto_luks_resize (const gchar *luks_device, guint64 size, BDCrypto ret = crypt_resize (cd, luks_device, size); if (ret != 0) { if (ret == -EPERM && g_strcmp0 (crypt_get_type (cd), CRYPT_LUKS2) == 0) { - g_set_error (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_RESIZE_PERM, - "Insufficient permissions to resize device. You need to specify" - " passphrase or keyfile to resize LUKS 2 devices that don't" - " have verified key loaded in kernel."); + g_set_error_literal (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_RESIZE_PERM, + "Insufficient permissions to resize device. You need to specify" + " passphrase or keyfile to resize LUKS 2 devices that don't" + " have verified key loaded in kernel."); crypt_free (cd); bd_utils_report_finished (progress_id, l_error->message); g_propagate_error (error, l_error); @@ -2019,8 +2019,8 @@ gboolean bd_crypto_luks_resume (const gchar *luks_device, BDCryptoKeyslotContext ret = crypt_resume_by_passphrase (cd, luks_device, CRYPT_ANY_SLOT, key_buffer, buf_len); crypt_safe_free (key_buffer); } else { - g_set_error (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_INVALID_CONTEXT, - "Only 'passphrase' and 'key file' context types are valid for LUKS resume."); + g_set_error_literal (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_INVALID_CONTEXT, + "Only 'passphrase' and 'key file' context types are valid for LUKS resume."); bd_utils_report_finished (progress_id, l_error->message); g_propagate_error (error, l_error); crypt_free (cd); @@ -2215,14 +2215,14 @@ gboolean bd_crypto_luks_header_restore (const gchar *device, const gchar *backup */ gboolean bd_crypto_luks_check_label (const gchar *label, const gchar *subsystem, GError **error) { if (label && strlen (label) > 47) { - g_set_error (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_INVALID_PARAMS, - "Label for LUKS must be at most 47 characters long"); + g_set_error_literal (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_INVALID_PARAMS, + "Label for LUKS must be at most 47 characters long"); return FALSE; } if (subsystem && strlen (subsystem) > 47) { - g_set_error (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_INVALID_PARAMS, - "Subsystem for LUKS must be at most 47 characters long"); + g_set_error_literal (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_INVALID_PARAMS, + "Subsystem for LUKS must be at most 47 characters long"); return FALSE; } @@ -2260,8 +2260,8 @@ gboolean bd_crypto_luks_set_label (const gchar *device, const gchar *label, cons } if (g_strcmp0 (crypt_get_type (cd), CRYPT_LUKS2) != 0) { - g_set_error (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_TECH_UNAVAIL, - "Label can be set only on LUKS 2 devices."); + g_set_error_literal (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_TECH_UNAVAIL, + "Label can be set only on LUKS 2 devices."); crypt_free (cd); return FALSE; } @@ -2417,8 +2417,8 @@ gboolean bd_crypto_luks_set_persistent_flags (const gchar *device, BDCryptoLUKSP } if (g_strcmp0 (crypt_get_type (cd), CRYPT_LUKS2) != 0) { - g_set_error (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_DEVICE, - "Persistent flags can be set only on LUKS v2"); + g_set_error_literal (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_DEVICE, + "Persistent flags can be set only on LUKS v2"); crypt_free (cd); return FALSE; } @@ -2439,8 +2439,8 @@ gboolean bd_crypto_luks_set_persistent_flags (const gchar *device, BDCryptoLUKSP #ifdef LIBCRYPTSETUP_28 crypt_flags |= CRYPT_ACTIVATE_HIGH_PRIORITY; #else - g_set_error (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_TECH_UNAVAIL, - "Libcryptsetup 2.8 or newer is needed for 'high priority' flag support"); + g_set_error_literal (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_TECH_UNAVAIL, + "Libcryptsetup 2.8 or newer is needed for 'high priority' flag support"); crypt_free (cd); return FALSE; #endif @@ -2598,8 +2598,8 @@ BDCryptoLUKSInfo* bd_crypto_luks_info (const gchar *device, GError **error) { else if (g_strcmp0 (version, CRYPT_LUKS2) == 0) info->version = BD_CRYPTO_LUKS_VERSION_LUKS2; else { - g_set_error (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_TECH_UNAVAIL, - "Unknown or unsupported LUKS version"); + g_set_error_literal (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_TECH_UNAVAIL, + "Unknown or unsupported LUKS version"); bd_crypto_luks_info_free (info); crypt_free (cd); return NULL; @@ -2891,8 +2891,8 @@ gboolean bd_crypto_integrity_format (const gchar *device, const gchar *algorithm g_free (msg); if (context && context->type != BD_CRYPTO_KEYSLOT_CONTEXT_TYPE_VOLUME_KEY) { - g_set_error (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_INVALID_CONTEXT, - "Only 'volume key' context type is valid for integrity format."); + g_set_error_literal (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_INVALID_CONTEXT, + "Only 'volume key' context type is valid for integrity format."); bd_utils_report_finished (progress_id, l_error->message); g_propagate_error (error, l_error); return FALSE; @@ -3007,9 +3007,13 @@ gboolean bd_crypto_integrity_open (const gchar *device, const gchar *name, const guint32 activate_flags = 0; GError *l_error = NULL; + msg = g_strdup_printf ("Started opening '%s' integrity device", device); + progress_id = bd_utils_report_started (msg); + g_free (msg); + if (context && context->type != BD_CRYPTO_KEYSLOT_CONTEXT_TYPE_VOLUME_KEY) { - g_set_error (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_INVALID_CONTEXT, - "Only 'volume key' context type is valid for integrity format."); + g_set_error_literal (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_INVALID_CONTEXT, + "Only 'volume key' context type is valid for integrity open."); bd_utils_report_finished (progress_id, l_error->message); g_propagate_error (error, l_error); return FALSE; @@ -3052,12 +3056,11 @@ gboolean bd_crypto_integrity_open (const gchar *device, const gchar *name, const #endif } - if (!_is_dm_name_valid (name, error)) + if (!_is_dm_name_valid (name, &l_error)) { + bd_utils_report_finished (progress_id, l_error->message); + g_propagate_error (error, l_error); return FALSE; - - msg = g_strdup_printf ("Started opening '%s' integrity device", device); - progress_id = bd_utils_report_started (msg); - g_free (msg); + } ret = crypt_init (&cd, device); if (ret != 0) { @@ -3174,14 +3177,14 @@ gboolean bd_crypto_device_seems_encrypted (const gchar *device, GError **error) fd = open (device, O_RDONLY); if (fd == -1) { - g_set_error (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_DEVICE, "Failed to open device"); + g_set_error_literal (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_DEVICE, "Failed to open device"); bd_utils_report_finished (progress_id, l_error->message); g_propagate_error (error, l_error); return FALSE; } if (read (fd, buf, sizeof (buf)) != sizeof (buf)) { - g_set_error (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_DEVICE, "Failed to read device"); + g_set_error_literal (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_DEVICE, "Failed to read device"); bd_utils_report_finished (progress_id, l_error->message); g_propagate_error (error, l_error); close (fd); @@ -3245,8 +3248,8 @@ gboolean bd_crypto_tc_open_flags (const gchar *device, const gchar *name, BDCryp } if (context && context->type != BD_CRYPTO_KEYSLOT_CONTEXT_TYPE_PASSPHRASE) { - g_set_error (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_INVALID_CONTEXT, - "Only 'passphrase' context type is valid for TC open."); + g_set_error_literal (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_INVALID_CONTEXT, + "Only 'passphrase' context type is valid for TC open."); bd_utils_report_finished (progress_id, l_error->message); g_propagate_error (error, l_error); crypt_free (cd); @@ -3254,8 +3257,8 @@ gboolean bd_crypto_tc_open_flags (const gchar *device, const gchar *name, BDCryp } if ((context == NULL) && (keyfiles_count == 0)) { - g_set_error (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_NO_KEY, - "No passphrase nor key file specified, cannot open."); + g_set_error_literal (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_NO_KEY, + "No passphrase nor key file specified, cannot open."); bd_utils_report_finished (progress_id, l_error->message); g_propagate_error (error, l_error); return FALSE; @@ -3483,8 +3486,8 @@ gboolean bd_crypto_escrow_device (const gchar *device, const gchar *passphrase, if (!NSS_IsInitialized ()) if (NSS_NoDB_Init (NULL) != SECSuccess) { - g_set_error (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_NSS_INIT_FAILED, - "Failed to initialize NSS"); + g_set_error_literal (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_NSS_INIT_FAILED, + "Failed to initialize NSS"); bd_utils_report_finished (progress_id, l_error->message); g_propagate_error (error, l_error); return FALSE; @@ -3519,8 +3522,8 @@ gboolean bd_crypto_escrow_device (const gchar *device, const gchar *passphrase, cert_data_copy = g_strdup (cert_data); cert = CERT_DecodeCertFromPackage (cert_data_copy, strlen (cert_data_copy)); if (!cert) { - g_set_error (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_CERT_DECODE, - "Failed to decode the certificate data"); + g_set_error_literal (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_CERT_DECODE, + "Failed to decode the certificate data"); libvk_volume_free (volume); libvk_ui_free (ui); g_free (cert_data_copy); @@ -3671,8 +3674,8 @@ gboolean bd_crypto_bitlk_open_flags (const gchar *device, const gchar *name, BDC ret = crypt_activate_by_passphrase (cd, name, CRYPT_ANY_SLOT, key_buffer, buf_len, crypt_flags); crypt_safe_free (key_buffer); } else { - g_set_error (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_INVALID_CONTEXT, - "Only 'passphrase' and 'key file' context types are valid for BITLK open."); + g_set_error_literal (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_INVALID_CONTEXT, + "Only 'passphrase' and 'key file' context types are valid for BITLK open."); bd_utils_report_finished (progress_id, l_error->message); g_propagate_error (error, l_error); crypt_free (cd); @@ -3681,8 +3684,8 @@ gboolean bd_crypto_bitlk_open_flags (const gchar *device, const gchar *name, BDC if (ret < 0) { if (ret == -EPERM) - g_set_error (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_DEVICE, - "Failed to activate device: Incorrect passphrase."); + g_set_error_literal (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_DEVICE, + "Failed to activate device: Incorrect passphrase."); else g_set_error (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_DEVICE, "Failed to activate device: %s", strerror_l (-ret, c_locale)); @@ -3809,8 +3812,8 @@ gboolean bd_crypto_fvault2_open_flags (const gchar *device, const gchar *name, B ret = crypt_activate_by_passphrase (cd, name, CRYPT_ANY_SLOT, key_buffer, buf_len, crypt_flags); crypt_safe_free (key_buffer); } else { - g_set_error (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_INVALID_CONTEXT, - "Only 'passphrase' and 'key file' context types are valid for FVAULT2 open."); + g_set_error_literal (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_INVALID_CONTEXT, + "Only 'passphrase' and 'key file' context types are valid for FVAULT2 open."); bd_utils_report_finished (progress_id, l_error->message); g_propagate_error (error, l_error); crypt_free (cd); @@ -3819,8 +3822,8 @@ gboolean bd_crypto_fvault2_open_flags (const gchar *device, const gchar *name, B if (ret < 0) { if (ret == -EPERM) - g_set_error (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_DEVICE, - "Failed to activate device: Incorrect passphrase."); + g_set_error_literal (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_DEVICE, + "Failed to activate device: Incorrect passphrase."); else g_set_error (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_DEVICE, "Failed to activate device: %s", strerror_l (-ret, c_locale)); @@ -3995,8 +3998,8 @@ gboolean bd_crypto_opal_wipe_device (const gchar *device, BDCryptoKeyslotContext key_buf = (char *) context->u.passphrase.pass_data; buf_len = context->u.passphrase.data_len; } else { - g_set_error (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_INVALID_CONTEXT, - "Only 'passphrase' context type is valid for OPAL wipe."); + g_set_error_literal (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_INVALID_CONTEXT, + "Only 'passphrase' context type is valid for OPAL wipe."); bd_utils_report_finished (progress_id, l_error->message); g_propagate_error (error, l_error); crypt_free (cd); @@ -4058,14 +4061,14 @@ gboolean bd_crypto_opal_format (const gchar *device, const gchar *cipher, guint6 gboolean ret = FALSE; if (hw_encryption != BD_CRYPTO_LUKS_HW_ENCRYPTION_OPAL_HW_AND_SW && hw_encryption != BD_CRYPTO_LUKS_HW_ENCRYPTION_OPAL_HW_ONLY) { - g_set_error (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_FORMAT_FAILED, - "Either hardware and software encryption or hardware encryption only must be selected for OPAL format"); + g_set_error_literal (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_FORMAT_FAILED, + "Either hardware and software encryption or hardware encryption only must be selected for OPAL format"); return FALSE; } if (hw_encryption == BD_CRYPTO_LUKS_HW_ENCRYPTION_OPAL_HW_ONLY && cipher != NULL) { - g_set_error (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_FORMAT_FAILED, - "Cipher cannot be specified for hardware encryption only OPAL devices"); + g_set_error_literal (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_FORMAT_FAILED, + "Cipher cannot be specified for hardware encryption only OPAL devices"); return FALSE; } @@ -4145,8 +4148,8 @@ gboolean bd_crypto_opal_reset_device (const gchar *device, BDCryptoKeyslotContex return FALSE; } } else { - g_set_error (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_INVALID_CONTEXT, - "Only 'passphrase' and 'key file' context types are valid for OPAL PSID reset."); + g_set_error_literal (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_INVALID_CONTEXT, + "Only 'passphrase' and 'key file' context types are valid for OPAL PSID reset."); bd_utils_report_finished (progress_id, l_error->message); g_propagate_error (error, l_error); crypt_free (cd); diff --git a/src/plugins/dm.c b/src/plugins/dm.c index d764232d8..f829fbee1 100644 --- a/src/plugins/dm.c +++ b/src/plugins/dm.c @@ -179,14 +179,14 @@ gchar* bd_dm_name_from_node (const gchar *dm_node, GError **error) { g_autofree gchar *sys_path = g_strdup_printf ("/sys/class/block/%s/dm/name", dm_node); if (!dm_node || strlen (dm_node) == 0) { - g_set_error (error, BD_DM_ERROR, BD_DM_ERROR_DEVICE_NOEXIST, - "No DM node specified"); + g_set_error_literal (error, BD_DM_ERROR, BD_DM_ERROR_DEVICE_NOEXIST, + "No DM node specified"); return NULL; } if (access (sys_path, R_OK) != 0) { - g_set_error (error, BD_DM_ERROR, BD_DM_ERROR_SYS, - "Failed to access dm node's parameters under /sys"); + g_set_error_literal (error, BD_DM_ERROR, BD_DM_ERROR_SYS, + "Failed to access dm node's parameters under /sys"); return NULL; } @@ -215,8 +215,8 @@ gchar* bd_dm_node_from_name (const gchar *map_name, GError **error) { g_autofree gchar *dev_mapper_path = g_strdup_printf ("/dev/mapper/%s", map_name); if (!map_name || strlen (map_name) == 0) { - g_set_error (error, BD_DM_ERROR, BD_DM_ERROR_DEVICE_NOEXIST, - "No DM name specified"); + g_set_error_literal (error, BD_DM_ERROR, BD_DM_ERROR_DEVICE_NOEXIST, + "No DM name specified"); return NULL; } @@ -246,28 +246,28 @@ gchar* bd_dm_get_subsystem_from_name (const gchar *device_name, GError **error) task = dm_task_create (DM_DEVICE_INFO); if (!task) { - g_set_error (error, BD_DM_ERROR, BD_DM_ERROR_TASK, - "Failed to create DM task"); + g_set_error_literal (error, BD_DM_ERROR, BD_DM_ERROR_TASK, + "Failed to create DM task"); return NULL; } if (!dm_task_set_name (task, device_name)) { - g_set_error (error, BD_DM_ERROR, BD_DM_ERROR_TASK, - "Failed to set device name for DM task"); + g_set_error_literal (error, BD_DM_ERROR, BD_DM_ERROR_TASK, + "Failed to set device name for DM task"); dm_task_destroy (task); return NULL; } if (!dm_task_run (task)) { - g_set_error (error, BD_DM_ERROR, BD_DM_ERROR_TASK, - "Failed to run DM task"); + g_set_error_literal (error, BD_DM_ERROR, BD_DM_ERROR_TASK, + "Failed to run DM task"); dm_task_destroy (task); return NULL; } if (!dm_task_get_info (task, &info)) { - g_set_error (error, BD_DM_ERROR, BD_DM_ERROR_TASK, - "Failed to get info from DM task"); + g_set_error_literal (error, BD_DM_ERROR, BD_DM_ERROR_TASK, + "Failed to get info from DM task"); dm_task_destroy (task); return NULL; } @@ -317,15 +317,15 @@ gboolean bd_dm_map_exists (const gchar *map_name, gboolean live_only, gboolean a gboolean ret = FALSE; if (geteuid () != 0) { - g_set_error (error, BD_DM_ERROR, BD_DM_ERROR_NOT_ROOT, - "Not running as root, cannot query DM maps"); + g_set_error_literal (error, BD_DM_ERROR, BD_DM_ERROR_NOT_ROOT, + "Not running as root, cannot query DM maps"); return FALSE; } task_list = dm_task_create (DM_DEVICE_LIST); if (!task_list) { - g_set_error (error, BD_DM_ERROR, BD_DM_ERROR_TASK, - "Failed to create DM task"); + g_set_error_literal (error, BD_DM_ERROR, BD_DM_ERROR_TASK, + "Failed to create DM task"); return FALSE; } @@ -348,8 +348,8 @@ gboolean bd_dm_map_exists (const gchar *map_name, gboolean live_only, gboolean a /* get device info */ task_info = dm_task_create (DM_DEVICE_INFO); if (!task_info) { - g_set_error (error, BD_DM_ERROR, BD_DM_ERROR_TASK, - "Failed to create DM task"); + g_set_error_literal (error, BD_DM_ERROR, BD_DM_ERROR_TASK, + "Failed to create DM task"); break; } diff --git a/src/plugins/fs.c b/src/plugins/fs.c index 8fcf0bb06..57d2626c5 100644 --- a/src/plugins/fs.c +++ b/src/plugins/fs.c @@ -91,7 +91,7 @@ gboolean bd_fs_is_tech_avail (BDFSTech tech, guint64 mode, GError **error) { return TRUE; if (tech > BD_FS_LAST_FS) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_TECH_UNAVAIL, "Unknown technology"); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_TECH_UNAVAIL, "Unknown technology"); return FALSE; } @@ -120,7 +120,7 @@ gboolean bd_fs_is_tech_avail (BDFSTech tech, guint64 mode, GError **error) { default: /* this should never be reached (see the comparison with LAST_FS above), but better safe than sorry */ - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_TECH_UNAVAIL, "Unknown technology"); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_TECH_UNAVAIL, "Unknown technology"); return FALSE; } } diff --git a/src/plugins/fs/btrfs.c b/src/plugins/fs/btrfs.c index 71071809c..883224e22 100644 --- a/src/plugins/fs/btrfs.c +++ b/src/plugins/fs/btrfs.c @@ -238,14 +238,14 @@ gboolean bd_fs_btrfs_set_label (const gchar *mpoint, const gchar *label, GError */ gboolean bd_fs_btrfs_check_label (const gchar *label, GError **error) { if (strlen (label) > 256) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_LABEL_INVALID, - "Label for btrfs filesystem must be at most 256 characters long."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_LABEL_INVALID, + "Label for btrfs filesystem must be at most 256 characters long."); return FALSE; } if (strchr (label, '\n') != NULL) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_LABEL_INVALID, - "Label for btrfs filesystem cannot contain new lines."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_LABEL_INVALID, + "Label for btrfs filesystem cannot contain new lines."); return FALSE; } @@ -351,8 +351,8 @@ BDFSBtrfsInfo* bd_fs_btrfs_get_info (const gchar *mpoint, GError **error) { success = g_regex_match (regex, output, 0, &match_info); if (!success) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_PARSE, - "Failed to parse btrfs filesystem information"); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_PARSE, + "Failed to parse btrfs filesystem information"); g_regex_unref (regex); g_match_info_free (match_info); return NULL; @@ -401,8 +401,8 @@ BDFSBtrfsInfo* bd_fs_btrfs_get_info (const gchar *mpoint, GError **error) { /* 114032640 bytes (108.75MiB) */ scanned = sscanf (output, " %" G_GUINT64_FORMAT " bytes", &min_size); if (scanned != 1) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_PARSE, - "Failed to parse btrfs filesystem min size."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_PARSE, + "Failed to parse btrfs filesystem min size."); bd_fs_btrfs_info_free (ret); return NULL; } diff --git a/src/plugins/fs/common.c b/src/plugins/fs/common.c index 586484a4b..7bebfdc1c 100644 --- a/src/plugins/fs/common.c +++ b/src/plugins/fs/common.c @@ -139,16 +139,16 @@ check_uuid (const gchar *uuid, GError **error) { uuid_t uu; if (!g_str_is_ascii (uuid)) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_UUID_INVALID, - "Provided UUID is not a valid RFC-4122 UUID."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_UUID_INVALID, + "Provided UUID is not a valid RFC-4122 UUID."); return FALSE; } lowercase = g_ascii_strdown (uuid, -1); ret = uuid_parse (lowercase, uu); if (ret < 0){ - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_UUID_INVALID, - "Provided UUID is not a valid RFC-4122 UUID."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_UUID_INVALID, + "Provided UUID is not a valid RFC-4122 UUID."); return FALSE; } diff --git a/src/plugins/fs/exfat.c b/src/plugins/fs/exfat.c index fc5905ff3..7d7cfe927 100644 --- a/src/plugins/fs/exfat.c +++ b/src/plugins/fs/exfat.c @@ -79,8 +79,8 @@ bd_fs_exfat_is_tech_avail (BDFSTech tech G_GNUC_UNUSED, guint64 mode, GError **e guint i = 0; if (mode & BD_FS_TECH_MODE_RESIZE) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_TECH_UNAVAIL, - "exFAT currently doesn't support resizing."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_TECH_UNAVAIL, + "exFAT currently doesn't support resizing."); return FALSE; } @@ -259,14 +259,14 @@ gboolean bd_fs_exfat_check_label (const gchar *label, GError **error) { } if (!str) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_LABEL_INVALID, - "Label for exFAT filesystem must be a valid UTF-8 string."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_LABEL_INVALID, + "Label for exFAT filesystem must be a valid UTF-8 string."); return FALSE; } if (bytes_written > 22) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_LABEL_INVALID, - "Label for exFAT filesystem is too long."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_LABEL_INVALID, + "Label for exFAT filesystem is too long."); return FALSE; } @@ -349,15 +349,15 @@ gboolean bd_fs_exfat_check_uuid (const gchar *uuid, GError **error) { vol_id = g_ascii_strtoull (new_uuid, &endptr, 16); if ((vol_id == 0 && endptr == new_uuid) || (endptr && *endptr)) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_UUID_INVALID, - "UUID for exFAT filesystem must be a hexadecimal number."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_UUID_INVALID, + "UUID for exFAT filesystem must be a hexadecimal number."); g_free (new_uuid); return FALSE; } if (vol_id > G_MAXUINT32) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_UUID_INVALID, - "UUID for exFAT filesystem must fit into 32 bits."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_UUID_INVALID, + "UUID for exFAT filesystem must fit into 32 bits."); g_free (new_uuid); return FALSE; } @@ -432,8 +432,8 @@ BDFSExfatInfo* bd_fs_exfat_get_info (const gchar *device, GError **error) { g_strfreev (lines); if (ret->sector_size == 0 || ret->sector_count == 0 || ret->cluster_count == 0) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, - "Failed to to parse exFAT info."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, + "Failed to parse exFAT info."); bd_fs_exfat_info_free (ret); return NULL; } diff --git a/src/plugins/fs/ext.c b/src/plugins/fs/ext.c index be6fc6b7e..b63181b49 100644 --- a/src/plugins/fs/ext.c +++ b/src/plugins/fs/ext.c @@ -558,8 +558,8 @@ gboolean bd_fs_ext4_set_label (const gchar *device, const gchar *label, GError * */ gboolean bd_fs_ext2_check_label (const gchar *label, GError **error) { if (strlen (label) > 16) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_LABEL_INVALID, - "Label for ext filesystem must be at most 16 characters long."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_LABEL_INVALID, + "Label for ext filesystem must be at most 16 characters long."); return FALSE; } @@ -735,7 +735,7 @@ static BDFSExtInfo* ext_get_info (const gchar *device, GError **error) { unix_io_manager, &fs); if (retval) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, "Failed to open ext4 file system"); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, "Failed to open ext4 file system"); return NULL; } diff --git a/src/plugins/fs/f2fs.c b/src/plugins/fs/f2fs.c index 66391d217..7c18319df 100644 --- a/src/plugins/fs/f2fs.c +++ b/src/plugins/fs/f2fs.c @@ -114,14 +114,14 @@ bd_fs_f2fs_is_tech_avail (BDFSTech tech G_GNUC_UNUSED, guint64 mode, GError **er guint i = 0; if (mode & BD_FS_TECH_MODE_SET_LABEL) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_TECH_UNAVAIL, - "F2FS doesn't support setting label for an existing device."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_TECH_UNAVAIL, + "F2FS doesn't support setting label for an existing device."); return FALSE; } if (mode & BD_FS_TECH_MODE_SET_UUID) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_TECH_UNAVAIL, - "F2FS doesn't support setting UUID for an existing device."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_TECH_UNAVAIL, + "F2FS doesn't support setting UUID for an existing device."); return FALSE; } @@ -323,7 +323,7 @@ BDFSF2FSInfo* bd_fs_f2fs_get_info (const gchar *device, GError **error) { while (line_p && *line_p && !g_str_has_prefix (*line_p, "Info: total FS sectors")) line_p++; if (!line_p || !(*line_p)) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_PARSE, "Failed to parse F2FS file system information"); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_PARSE, "Failed to parse F2FS file system information"); g_strfreev (lines); bd_fs_f2fs_info_free (ret); return NULL; @@ -338,7 +338,7 @@ BDFSF2FSInfo* bd_fs_f2fs_get_info (const gchar *device, GError **error) { while (line_p && *line_p && !g_str_has_prefix (*line_p, "Info: superblock features")) line_p++; if (!line_p || !(*line_p)) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_PARSE, "Failed to parse F2FS file system information"); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_PARSE, "Failed to parse F2FS file system information"); g_strfreev (lines); bd_fs_f2fs_info_free (ret); return NULL; @@ -395,8 +395,8 @@ gboolean bd_fs_f2fs_resize (const gchar *device, guint64 new_size, gboolean safe if (new_size != 0 && new_size < info->sector_count && !safe) { /* resize.f2fs prints error and returns 0 in this case */ - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_INVAL, - "F2FS filesystem doesn't support shrinking without using the 'safe' option"); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_INVAL, + "F2FS filesystem doesn't support shrinking without using the 'safe' option"); bd_fs_f2fs_info_free (info); return FALSE; } @@ -435,8 +435,8 @@ gboolean bd_fs_f2fs_check_label (const gchar *label, GError **error) { len = strlen (label); if (len > 512) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_LABEL_INVALID, - "Label for F2FS filesystem must be at most 512 characters long."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_LABEL_INVALID, + "Label for F2FS filesystem must be at most 512 characters long."); return FALSE; } diff --git a/src/plugins/fs/generic.c b/src/plugins/fs/generic.c index 05bc5d2c2..87ed8b0ec 100644 --- a/src/plugins/fs/generic.c +++ b/src/plugins/fs/generic.c @@ -398,8 +398,8 @@ gboolean bd_fs_wipe (const gchar *device, gboolean all, gboolean force, GError * probe = blkid_new_probe (); if (!probe) { - g_set_error (&l_error, BD_FS_ERROR, BD_FS_ERROR_FAIL, - "Failed to create a new probe"); + g_set_error_literal (&l_error, BD_FS_ERROR, BD_FS_ERROR_FAIL, + "Failed to create a new probe"); bd_utils_report_finished (progress_id, l_error->message); g_propagate_error (error, l_error); return FALSE; @@ -563,8 +563,8 @@ gchar* bd_fs_get_fstype (const gchar *device, GError **error) { probe = blkid_new_probe (); if (!probe) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, - "Failed to create a new probe"); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, + "Failed to create a new probe"); return NULL; } @@ -1306,8 +1306,8 @@ gboolean bd_fs_check (const gchar *device, const gchar *fstype, GError **error) */ gboolean bd_fs_check_label (const gchar *fstype, const gchar *label, GError **error) { if (!fstype || strlen (fstype) == 0) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_NOFS, - "Filesystem type must be specified to check label format"); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_NOFS, + "Filesystem type must be specified to check label format"); return FALSE; } return device_operation (NULL, fstype, BD_FS_LABEL_CHECK, 0, label, NULL, error); @@ -1353,8 +1353,8 @@ gboolean bd_fs_set_label (const gchar *device, const gchar *label, const gchar * */ gboolean bd_fs_check_uuid (const gchar *fstype, const gchar *uuid, GError **error) { if (!fstype || strlen (fstype) == 0) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_NOFS, - "Filesystem type must be specified to check UUID format"); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_NOFS, + "Filesystem type must be specified to check UUID format"); return FALSE; } return device_operation (NULL, fstype, BD_FS_UUID_CHECK, 0, NULL, uuid, error); diff --git a/src/plugins/fs/mount.c b/src/plugins/fs/mount.c index eaf098a9b..2691be109 100644 --- a/src/plugins/fs/mount.c +++ b/src/plugins/fs/mount.c @@ -67,16 +67,16 @@ static gboolean get_unmount_error_old (struct libmnt_context *cxt, int rc, const case 0: return TRUE; case EBUSY: - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, - "Target busy."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, + "Target busy."); break; case EINVAL: - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, - "Not a mount point."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, + "Not a mount point."); break; case EPERM: - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_AUTH, - "Operation not permitted."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_AUTH, + "Operation not permitted."); break; default: g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, @@ -96,11 +96,11 @@ static gboolean get_unmount_error_old (struct libmnt_context *cxt, int rc, const return TRUE; else if (rc == -EPERM) { if (mnt_context_tab_applied (cxt)) - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_AUTH, - "Operation not permitted."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_AUTH, + "Operation not permitted."); else - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, - "Not mounted."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, + "Not mounted."); } else { g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, "Failed to unmount %s.", spec); @@ -125,8 +125,8 @@ static gboolean get_unmount_error_new (struct libmnt_context *cxt, int rc, const permission = ret == MNT_EX_USAGE && mnt_context_tab_applied (cxt); if (permission) - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_AUTH, - "Operation not permitted."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_AUTH, + "Operation not permitted."); else { if (*buf == '\0') g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, @@ -206,8 +206,8 @@ static gboolean get_mount_error_old (struct libmnt_context *cxt, int rc, MountAr case 0: return TRUE; case EBUSY: - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, - "Source is already mounted or target is busy."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, + "Source is already mounted or target is busy."); break; case EINVAL: if (mflags & MS_REMOUNT) @@ -221,8 +221,8 @@ static gboolean get_mount_error_old (struct libmnt_context *cxt, int rc, MountAr "Wrong fs type, %s has an invalid superblock or missing helper program.", args->device); break; case EPERM: - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_AUTH, - "Operation not permitted."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_AUTH, + "Operation not permitted."); break; case ENOTBLK: g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, @@ -234,8 +234,8 @@ static gboolean get_mount_error_old (struct libmnt_context *cxt, int rc, MountAr break; case ENODEV: if (args->fstype == NULL || strlen (args->fstype) == 0) - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, - "Filesystem type not specified"); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, + "Filesystem type not specified"); else g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_UNKNOWN_FS, "Filesystem type %s not configured in kernel.", args->fstype); @@ -305,24 +305,24 @@ static gboolean get_mount_error_old (struct libmnt_context *cxt, int rc, MountAr "Can't find %s in %s.", args->device ? args->device : args->mountpoint, mnt_get_fstab_path ()); break; case -MNT_ERR_MOUNTOPT: - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, - "Failed to parse mount options"); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, + "Failed to parse mount options"); break; case -MNT_ERR_NOSOURCE: if (args->device) g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, "Can't find %s.", args->device); else - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, - "Mount source not defined."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, + "Mount source not defined."); break; case -MNT_ERR_LOOPDEV: - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, - "Failed to setup loop device"); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, + "Failed to setup loop device"); break; case -MNT_ERR_NOFSTYPE: - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, - "Filesystem type not specified"); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, + "Filesystem type not specified"); break; default: g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, @@ -351,8 +351,8 @@ static gboolean get_mount_error_new (struct libmnt_context *cxt, int rc, MountAr permission = ret == MNT_EX_USAGE && mnt_context_tab_applied (cxt); if (permission) - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_AUTH, - "Operation not permitted."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_AUTH, + "Operation not permitted."); else if (syscall_errno == ENODEV) g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_UNKNOWN_FS, "Filesystem type %s not configured in kernel.", args->fstype); @@ -380,8 +380,8 @@ static gboolean do_mount (MountArgs *args, GError **error) { cxt = mnt_new_context (); if (!args->mountpoint && !args->device) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, - "You must specify at least one of: mount point, device."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, + "You must specify at least one of: mount point, device."); mnt_free_context (cxt); return FALSE; } @@ -496,22 +496,22 @@ static gboolean run_as_user (MountFunc func, MountArgs *args, uid_t run_as_uid, current_gid = getgid (); if (geteuid () != 0) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, - "Not running as root, cannot change the UID/GID."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, + "Not running as root, cannot change the UID/GID."); return FALSE; } if (pipe(pipefd) == -1) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, - "Error creating pipe."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, + "Error creating pipe."); return FALSE; } pid = fork (); if (pid == -1) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, - "Error forking."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, + "Error forking."); return FALSE; } else if (pid == 0) { close (pipefd[0]); @@ -549,8 +549,8 @@ static gboolean run_as_user (MountFunc func, MountArgs *args, uid_t run_as_uid, do { wpid = waitpid (pid, &status, WUNTRACED | WCONTINUED); if (wpid == -1) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, - "Error while waiting for process."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, + "Error while waiting for process."); close (pipefd[0]); return FALSE; } @@ -558,8 +558,8 @@ static gboolean run_as_user (MountFunc func, MountArgs *args, uid_t run_as_uid, if (WIFEXITED (status)) { if (WEXITSTATUS (status) != EXIT_SUCCESS) { if (WEXITSTATUS (status) == BD_FS_ERROR_PIPE) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, - "Error while reading error."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, + "Error while reading error."); close (pipefd[0]); return FALSE; } @@ -572,8 +572,8 @@ static gboolean run_as_user (MountFunc func, MountArgs *args, uid_t run_as_uid, local_error->message, local_error->code); g_clear_error (&local_error); } else - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, - "Unknown error while reading error."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, + "Unknown error while reading error."); g_io_channel_unref (channel); close (pipefd[0]); g_free (error_msg); @@ -808,8 +808,8 @@ gchar* bd_fs_get_mountpoint (const gchar *device, GError **error) { ret = mnt_table_set_cache (table, cache); if (ret != 0) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, - "Failed to set cache for mount info table."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, + "Failed to set cache for mount info table."); mnt_free_table (table); mnt_free_cache (cache); return NULL; @@ -817,8 +817,8 @@ gchar* bd_fs_get_mountpoint (const gchar *device, GError **error) { ret = mnt_table_parse_mtab (table, NULL); if (ret != 0) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, - "Failed to parse mount info."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, + "Failed to parse mount info."); mnt_free_table (table); mnt_free_cache (cache); return NULL; @@ -865,8 +865,8 @@ gboolean bd_fs_is_mountpoint (const gchar *path, GError **error) { ret = mnt_table_set_cache (table, cache); if (ret != 0) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, - "Failed to set cache for mount info table."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, + "Failed to set cache for mount info table."); mnt_free_table (table); mnt_free_cache (cache); return FALSE; @@ -874,8 +874,8 @@ gboolean bd_fs_is_mountpoint (const gchar *path, GError **error) { ret = mnt_table_parse_mtab (table, NULL); if (ret != 0) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, - "Failed to parse mount info."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, + "Failed to parse mount info."); mnt_free_table (table); mnt_free_cache (cache); return FALSE; diff --git a/src/plugins/fs/nilfs.c b/src/plugins/fs/nilfs.c index c42396751..29607cc03 100644 --- a/src/plugins/fs/nilfs.c +++ b/src/plugins/fs/nilfs.c @@ -76,14 +76,14 @@ bd_fs_nilfs2_is_tech_avail (BDFSTech tech G_GNUC_UNUSED, guint64 mode, GError ** guint i = 0; if (mode & BD_FS_TECH_MODE_CHECK) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_TECH_UNAVAIL, - "NILFS2 doesn't support filesystem check."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_TECH_UNAVAIL, + "NILFS2 doesn't support filesystem check."); return FALSE; } if (mode & BD_FS_TECH_MODE_REPAIR) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_TECH_UNAVAIL, - "NILFS2 doesn't support filesystem repair."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_TECH_UNAVAIL, + "NILFS2 doesn't support filesystem repair."); return FALSE; } @@ -207,8 +207,8 @@ gboolean bd_fs_nilfs2_set_label (const gchar *device, const gchar *label, GError */ gboolean bd_fs_nilfs2_check_label (const gchar *label, GError **error) { if (strlen (label) > 80) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_LABEL_INVALID, - "Label for nilfs2 filesystem must be at most 80 characters long."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_LABEL_INVALID, + "Label for nilfs2 filesystem must be at most 80 characters long."); return FALSE; } @@ -302,7 +302,7 @@ BDFSNILFS2Info* bd_fs_nilfs2_get_info (const gchar *device, GError **error) { while (line_p && *line_p && !g_str_has_prefix (*line_p, "Block size:")) line_p++; if (!line_p || !(*line_p)) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_PARSE, "Failed to parse NILFS2 file system information"); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_PARSE, "Failed to parse NILFS2 file system information"); g_strfreev (lines); bd_fs_nilfs2_info_free (ret); return NULL; @@ -317,7 +317,7 @@ BDFSNILFS2Info* bd_fs_nilfs2_get_info (const gchar *device, GError **error) { while (line_p && *line_p && !g_str_has_prefix (*line_p, "Device size")) line_p++; if (!line_p || !(*line_p)) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_PARSE, "Failed to parse NILFS2 file system information"); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_PARSE, "Failed to parse NILFS2 file system information"); g_strfreev (lines); bd_fs_nilfs2_info_free (ret); return NULL; @@ -332,7 +332,7 @@ BDFSNILFS2Info* bd_fs_nilfs2_get_info (const gchar *device, GError **error) { while (line_p && *line_p && !g_str_has_prefix (*line_p, "Free blocks count")) line_p++; if (!line_p || !(*line_p)) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_PARSE, "Failed to parse NILFS2 file system information"); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_PARSE, "Failed to parse NILFS2 file system information"); g_strfreev (lines); bd_fs_nilfs2_info_free (ret); return NULL; diff --git a/src/plugins/fs/ntfs.c b/src/plugins/fs/ntfs.c index a7b626c7d..dc0ec9e83 100644 --- a/src/plugins/fs/ntfs.c +++ b/src/plugins/fs/ntfs.c @@ -236,8 +236,8 @@ gboolean bd_fs_ntfs_set_label (const gchar *device, const gchar *label, GError * */ gboolean bd_fs_ntfs_check_label (const gchar *label, GError **error) { if (strlen (label) > 128) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_LABEL_INVALID, - "Label for NTFS filesystem must be at most 128 characters long."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_LABEL_INVALID, + "Label for NTFS filesystem must be at most 128 characters long."); return FALSE; } @@ -269,8 +269,8 @@ gboolean bd_fs_ntfs_set_uuid (const gchar *device, const gchar *uuid, GError **e else if (strlen (uuid) == 8) args[2] = g_strdup_printf ("--new-half-serial=%s", uuid); else { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, - "Invalid format of UUID/serial number for NTFS filesystem."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, + "Invalid format of UUID/serial number for NTFS filesystem."); return FALSE; } @@ -295,15 +295,15 @@ gboolean bd_fs_ntfs_check_uuid (const gchar *uuid, GError **error) { len = strlen (uuid); if (len != 8 && len != 16) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_UUID_INVALID, - "UUID for NTFS filesystem must be either 8 or 16 characters long."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_UUID_INVALID, + "UUID for NTFS filesystem must be either 8 or 16 characters long."); return FALSE; } for (size_t i = 0; i < len; i++) { if (!g_ascii_isxdigit (uuid[i])) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_UUID_INVALID, - "UUID for NTFS filesystem must be a hexadecimal number."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_UUID_INVALID, + "UUID for NTFS filesystem must be a hexadecimal number."); return FALSE; } } @@ -406,7 +406,7 @@ BDFSNtfsInfo* bd_fs_ntfs_get_info (const gchar *device, GError **error) { while (line_p && *line_p && !strstr (*line_p, "Cluster Size:")) line_p++; if (!line_p || !(*line_p)) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_PARSE, "Failed to parse NTFS file system information"); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_PARSE, "Failed to parse NTFS file system information"); g_strfreev (lines); bd_fs_ntfs_info_free (ret); return NULL; @@ -420,7 +420,7 @@ BDFSNtfsInfo* bd_fs_ntfs_get_info (const gchar *device, GError **error) { while (line_p && *line_p && !strstr (*line_p, "Volume Size in Clusters:")) line_p++; if (!line_p || !(*line_p)) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_PARSE, "Failed to parse NTFS file system information"); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_PARSE, "Failed to parse NTFS file system information"); g_strfreev (lines); bd_fs_ntfs_info_free (ret); return NULL; @@ -434,7 +434,7 @@ BDFSNtfsInfo* bd_fs_ntfs_get_info (const gchar *device, GError **error) { while (line_p && *line_p && !strstr (*line_p, "Free Clusters:")) line_p++; if (!line_p || !(*line_p)) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_PARSE, "Failed to parse NTFS file system information"); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_PARSE, "Failed to parse NTFS file system information"); g_strfreev (lines); bd_fs_ntfs_info_free (ret); return NULL; diff --git a/src/plugins/fs/udf.c b/src/plugins/fs/udf.c index 8e0911e0a..bfd7e8d90 100644 --- a/src/plugins/fs/udf.c +++ b/src/plugins/fs/udf.c @@ -76,12 +76,12 @@ bd_fs_udf_is_tech_avail (BDFSTech tech G_GNUC_UNUSED, guint64 mode, GError **err guint i = 0; if (mode & BD_FS_TECH_MODE_CHECK || mode & BD_FS_TECH_MODE_REPAIR) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_TECH_UNAVAIL, - "UDF doesn't support checking and reparing."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_TECH_UNAVAIL, + "UDF doesn't support checking and reparing."); return FALSE; } else if (mode & BD_FS_TECH_MODE_RESIZE) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_TECH_UNAVAIL, - "UDF currently doesn't support resizing."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_TECH_UNAVAIL, + "UDF currently doesn't support resizing."); return FALSE; } @@ -335,8 +335,8 @@ gboolean bd_fs_udf_check_label (const gchar *label, GError **error) { if (g_str_is_ascii (label)) { if (strlen (label) > 126) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_LABEL_INVALID, - "Label for UDF filesystem can be at most 126 characters long."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_LABEL_INVALID, + "Label for UDF filesystem can be at most 126 characters long."); return FALSE; } @@ -350,8 +350,8 @@ gboolean bd_fs_udf_check_label (const gchar *label, GError **error) { return TRUE; if (len > 126) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_LABEL_INVALID, - "Label for UDF filesystem can be at most 126 characters long."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_LABEL_INVALID, + "Label for UDF filesystem can be at most 126 characters long."); return FALSE; } @@ -359,17 +359,17 @@ gboolean bd_fs_udf_check_label (const gchar *label, GError **error) { while (next_p && *next_p) { unichar = g_utf8_get_char (next_p); if (unichar > 0xFF) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_LABEL_INVALID, - "Label for UDF filesystem containing unicode characters above U+FF can "\ - "be at most 63 characters long."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_LABEL_INVALID, + "Label for UDF filesystem containing unicode characters above U+FF can "\ + "be at most 63 characters long."); return FALSE; } next_p = g_utf8_next_char (next_p); } } else { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_LABEL_INVALID, - "Label for UDF filesystem must be a valid UTF-8 string."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_LABEL_INVALID, + "Label for UDF filesystem must be a valid UTF-8 string."); return FALSE; } @@ -420,15 +420,15 @@ gboolean bd_fs_udf_check_uuid (const gchar *uuid, GError **error) { len = strlen (uuid); if (len != 16) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_UUID_INVALID, - "UUID for UDF filesystem must be 16 characters long."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_UUID_INVALID, + "UUID for UDF filesystem must be 16 characters long."); return FALSE; } for (size_t i = 0; i < len; i++) { if (!g_ascii_isxdigit (uuid[i]) || (!g_ascii_isdigit (uuid[i]) && !g_ascii_islower (uuid[i]))) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_UUID_INVALID, - "UUID for UDF filesystem must be a lowercase hexadecimal number."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_UUID_INVALID, + "UUID for UDF filesystem must be a lowercase hexadecimal number."); return FALSE; } } @@ -533,7 +533,7 @@ BDFSUdfInfo* bd_fs_udf_get_info (const gchar *device, GError **error) { g_free (output); if (!table || (num_items == 0)) { /* something bad happened or some expected items were missing */ - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_PARSE, "Failed to parse UDF file system information"); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_PARSE, "Failed to parse UDF file system information"); if (table) g_hash_table_destroy (table); return NULL; @@ -541,7 +541,7 @@ BDFSUdfInfo* bd_fs_udf_get_info (const gchar *device, GError **error) { ret = get_udf_data_from_table (table); if (!ret) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_PARSE, "Failed to parse UDF file system information"); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_PARSE, "Failed to parse UDF file system information"); return NULL; } diff --git a/src/plugins/fs/vfat.c b/src/plugins/fs/vfat.c index 744bc9fff..d9be62f8d 100644 --- a/src/plugins/fs/vfat.c +++ b/src/plugins/fs/vfat.c @@ -325,8 +325,8 @@ gboolean bd_fs_vfat_check_label (const gchar *label, GError **error) { guint n; if (strlen (label) > 11) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_LABEL_INVALID, - "Label for VFAT filesystem must be at most 11 characters long."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_LABEL_INVALID, + "Label for VFAT filesystem must be at most 11 characters long."); return FALSE; } @@ -394,15 +394,15 @@ gboolean bd_fs_vfat_check_uuid (const gchar *uuid, GError **error) { vol_id = g_ascii_strtoull (new_uuid, &endptr, 16); if ((vol_id == 0 && endptr == new_uuid) || (endptr && *endptr)) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_UUID_INVALID, - "UUID for VFAT filesystem must be a hexadecimal number."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_UUID_INVALID, + "UUID for VFAT filesystem must be a hexadecimal number."); g_free (new_uuid); return FALSE; } if (vol_id > G_MAXUINT32) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_UUID_INVALID, - "UUID for VFAT filesystem must fit into 32 bits."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_UUID_INVALID, + "UUID for VFAT filesystem must fit into 32 bits."); g_free (new_uuid); return FALSE; } diff --git a/src/plugins/fs/xfs.c b/src/plugins/fs/xfs.c index 85afb0cec..cd3b1ebc6 100644 --- a/src/plugins/fs/xfs.c +++ b/src/plugins/fs/xfs.c @@ -268,14 +268,14 @@ gboolean bd_fs_xfs_check_label (const gchar *label, GError **error) { len = strlen (label); if (len > 12) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_LABEL_INVALID, - "Label for XFS filesystem must be at most 12 characters long."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_LABEL_INVALID, + "Label for XFS filesystem must be at most 12 characters long."); return FALSE; } if (strchr (label, ' ') != NULL) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_LABEL_INVALID, - "Label for XFS filesystem cannot contain spaces."); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_LABEL_INVALID, + "Label for XFS filesystem cannot contain spaces."); return FALSE; } @@ -390,7 +390,7 @@ BDFSXfsInfo* bd_fs_xfs_get_info (const gchar *device, GError **error) { while (line_p && *line_p && !g_str_has_prefix (*line_p, "data")) line_p++; if (!line_p || !(*line_p)) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_PARSE, "Failed to parse xfs file system information"); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_PARSE, "Failed to parse xfs file system information"); g_strfreev (lines); bd_fs_xfs_info_free (ret); return NULL; @@ -399,7 +399,7 @@ BDFSXfsInfo* bd_fs_xfs_get_info (const gchar *device, GError **error) { /* extract data from something like this: "data = bsize=4096 blocks=262400, imaxpct=25" */ val_start = strchr (*line_p, '='); if (!val_start) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_PARSE, "Failed to parse xfs file system information"); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_PARSE, "Failed to parse xfs file system information"); g_strfreev (lines); bd_fs_xfs_info_free (ret); return NULL; @@ -410,7 +410,7 @@ BDFSXfsInfo* bd_fs_xfs_get_info (const gchar *device, GError **error) { if (g_str_has_prefix (val_start, "bsize")) { val_start = strchr (val_start, '='); if (!val_start) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_PARSE, "Failed to parse xfs file system information"); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_PARSE, "Failed to parse xfs file system information"); g_strfreev (lines); bd_fs_xfs_info_free (ret); return NULL; @@ -418,7 +418,7 @@ BDFSXfsInfo* bd_fs_xfs_get_info (const gchar *device, GError **error) { val_start++; ret->block_size = g_ascii_strtoull (val_start, NULL, 0); } else { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_PARSE, "Failed to parse xfs file system information"); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_PARSE, "Failed to parse xfs file system information"); g_strfreev (lines); bd_fs_xfs_info_free (ret); return NULL; @@ -428,7 +428,7 @@ BDFSXfsInfo* bd_fs_xfs_get_info (const gchar *device, GError **error) { if (g_str_has_prefix (val_start, "blocks")) { val_start = strchr (val_start, '='); if (!val_start) { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_PARSE, "Failed to parse xfs file system information"); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_PARSE, "Failed to parse xfs file system information"); g_strfreev (lines); bd_fs_xfs_info_free (ret); return NULL; @@ -436,7 +436,7 @@ BDFSXfsInfo* bd_fs_xfs_get_info (const gchar *device, GError **error) { val_start++; ret->block_count = g_ascii_strtoull (val_start, NULL, 0); } else { - g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_PARSE, "Failed to parse xfs file system information"); + g_set_error_literal (error, BD_FS_ERROR, BD_FS_ERROR_PARSE, "Failed to parse xfs file system information"); g_strfreev (lines); bd_fs_xfs_info_free (ret); return NULL; diff --git a/src/plugins/lvm/lvm-common.c b/src/plugins/lvm/lvm-common.c index 847d96ba3..9b0481be5 100644 --- a/src/plugins/lvm/lvm-common.c +++ b/src/plugins/lvm/lvm-common.c @@ -438,8 +438,8 @@ const gchar* bd_lvm_get_vdo_operating_mode_str (BDLVMVDOOperatingMode mode, GErr case BD_LVM_VDO_MODE_UNKNOWN: return "unknown"; default: - g_set_error (error, BD_LVM_ERROR, BD_LVM_ERROR_FAIL, - "Invalid LVM VDO operating mode."); + g_set_error_literal (error, BD_LVM_ERROR, BD_LVM_ERROR_FAIL, + "Invalid LVM VDO operating mode."); return NULL; } } @@ -462,8 +462,8 @@ const gchar* bd_lvm_get_vdo_compression_state_str (BDLVMVDOCompressionState stat case BD_LVM_VDO_COMPRESSION_UNKNOWN: return "unknown"; default: - g_set_error (error, BD_LVM_ERROR, BD_LVM_ERROR_FAIL, - "Invalid LVM VDO compression state."); + g_set_error_literal (error, BD_LVM_ERROR, BD_LVM_ERROR_FAIL, + "Invalid LVM VDO compression state."); return NULL; } } @@ -494,8 +494,8 @@ const gchar* bd_lvm_get_vdo_index_state_str (BDLVMVDOIndexState state, GError ** case BD_LVM_VDO_INDEX_UNKNOWN: return "unknown"; default: - g_set_error (error, BD_LVM_ERROR, BD_LVM_ERROR_FAIL, - "Invalid LVM VDO index state."); + g_set_error_literal (error, BD_LVM_ERROR, BD_LVM_ERROR_FAIL, + "Invalid LVM VDO index state."); return NULL; } } @@ -520,8 +520,8 @@ const gchar* bd_lvm_get_vdo_write_policy_str (BDLVMVDOWritePolicy policy, GError case BD_LVM_VDO_WRITE_POLICY_UNKNOWN: return "unknown"; default: - g_set_error (error, BD_LVM_ERROR, BD_LVM_ERROR_FAIL, - "Invalid LVM VDO write policy."); + g_set_error_literal (error, BD_LVM_ERROR, BD_LVM_ERROR_FAIL, + "Invalid LVM VDO write policy."); return NULL; } } @@ -688,8 +688,8 @@ gboolean bd_lvm_devices_add (const gchar *device, const gchar *devices_file, con return FALSE; if (!_lvm_devices_enabled ()) { - g_set_error (error, BD_LVM_ERROR, BD_LVM_ERROR_DEVICES_DISABLED, - "LVM devices file not enabled."); + g_set_error_literal (error, BD_LVM_ERROR, BD_LVM_ERROR_DEVICES_DISABLED, + "LVM devices file not enabled."); return FALSE; } @@ -720,8 +720,8 @@ gboolean bd_lvm_devices_delete (const gchar *device, const gchar *devices_file, return FALSE; if (!_lvm_devices_enabled ()) { - g_set_error (error, BD_LVM_ERROR, BD_LVM_ERROR_DEVICES_DISABLED, - "LVM devices file not enabled."); + g_set_error_literal (error, BD_LVM_ERROR, BD_LVM_ERROR_DEVICES_DISABLED, + "LVM devices file not enabled."); return FALSE; } @@ -757,8 +757,8 @@ gchar* bd_lvm_config_get (const gchar *section, const gchar *setting, const gcha gboolean success = FALSE; if (!section && setting) { - g_set_error (error, BD_LVM_ERROR, BD_LVM_ERROR_FAIL, - "Specifying setting without section is not supported."); + g_set_error_literal (error, BD_LVM_ERROR, BD_LVM_ERROR_FAIL, + "Specifying setting without section is not supported."); return NULL; } diff --git a/src/plugins/lvm/lvm-dbus.c b/src/plugins/lvm/lvm-dbus.c index 5fd722b30..31f64676a 100644 --- a/src/plugins/lvm/lvm-dbus.c +++ b/src/plugins/lvm/lvm-dbus.c @@ -235,8 +235,8 @@ static gboolean setup_dbus_connection (GError **error) { } if (g_dbus_connection_is_closed (bus)) { - g_set_error (error, BD_LVM_ERROR, BD_LVM_ERROR_FAIL, - "Connection is closed"); + g_set_error_literal (error, BD_LVM_ERROR, BD_LVM_ERROR_FAIL, + "Connection is closed"); return FALSE; } @@ -359,15 +359,15 @@ gboolean bd_lvm_is_tech_avail (BDLVMTech tech, guint64 mode, GError **error) { switch (tech) { case BD_LVM_TECH_THIN_CALCS: if (mode & ~BD_LVM_TECH_MODE_QUERY) { - g_set_error (error, BD_LVM_ERROR, BD_LVM_ERROR_TECH_UNAVAIL, - "Only 'query' supported for thin calculations"); + g_set_error_literal (error, BD_LVM_ERROR, BD_LVM_ERROR_TECH_UNAVAIL, + "Only 'query' supported for thin calculations"); return FALSE; } else return TRUE; case BD_LVM_TECH_CALCS: if (mode & ~BD_LVM_TECH_MODE_QUERY) { - g_set_error (error, BD_LVM_ERROR, BD_LVM_ERROR_TECH_UNAVAIL, - "Only 'query' supported for calculations"); + g_set_error_literal (error, BD_LVM_ERROR, BD_LVM_ERROR_TECH_UNAVAIL, + "Only 'query' supported for calculations"); return FALSE; } else return TRUE; @@ -439,8 +439,8 @@ static gchar* get_object_path (const gchar *obj_id, GError **error) { gchar *obj_path = NULL; if (!obj_id || g_strcmp0 (obj_id, "") == 0) { - g_set_error (error, BD_LVM_ERROR, BD_LVM_ERROR_NOEXIST, - "Invalid LVM ID specified"); + g_set_error_literal (error, BD_LVM_ERROR, BD_LVM_ERROR_NOEXIST, + "Invalid LVM ID specified"); return NULL; } @@ -762,8 +762,8 @@ static gboolean call_lvm_method_sync (const gchar *obj, const gchar *intf, const } else { g_variant_unref (ret); bd_utils_log_task_status (log_task_id, "Failed to parse the returned value!"); - g_set_error (error, BD_LVM_ERROR, BD_LVM_ERROR_PARSE, - "Failed to parse the returned value!"); + g_set_error_literal (error, BD_LVM_ERROR, BD_LVM_ERROR_PARSE, + "Failed to parse the returned value!"); bd_utils_report_finished (prog_id, "Failed to parse the returned value!"); return FALSE; } @@ -931,8 +931,8 @@ static GVariant* get_lvm_object_properties (const gchar *obj_id, const gchar *if gchar *obj_path = NULL; if (!obj_id || g_strcmp0 (obj_id, "") == 0) { - g_set_error (error, BD_LVM_ERROR, BD_LVM_ERROR_NOEXIST, - "Invalid LVM ID specified"); + g_set_error_literal (error, BD_LVM_ERROR, BD_LVM_ERROR_NOEXIST, + "Invalid LVM ID specified"); return NULL; } @@ -962,8 +962,8 @@ static GVariant* get_pv_properties (const gchar *pv_name, GError **error) { GVariant *ret = NULL; if (!pv_name || g_strcmp0 (pv_name, "") == 0) { - g_set_error (error, BD_LVM_ERROR, BD_LVM_ERROR_NOEXIST, - "Invalid LVM ID specified"); + g_set_error_literal (error, BD_LVM_ERROR, BD_LVM_ERROR_NOEXIST, + "Invalid LVM ID specified"); return NULL; } @@ -1536,8 +1536,8 @@ gboolean bd_lvm_pvcreate (const gchar *device, guint64 data_alignment, guint64 m GVariant *extra_params = NULL; if (!device || g_strcmp0 (device, "") == 0) { - g_set_error (error, BD_LVM_ERROR, BD_LVM_ERROR_NOEXIST, - "Invalid LVM ID specified"); + g_set_error_literal (error, BD_LVM_ERROR, BD_LVM_ERROR_NOEXIST, + "Invalid LVM ID specified"); return FALSE; } @@ -1605,8 +1605,8 @@ gboolean bd_lvm_pvremove (const gchar *device, const BDExtraArg **extra, GError gboolean ret = FALSE; if (!device || g_strcmp0 (device, "") == 0) { - g_set_error (error, BD_LVM_ERROR, BD_LVM_ERROR_NOEXIST, - "Invalid LVM ID specified"); + g_set_error_literal (error, BD_LVM_ERROR, BD_LVM_ERROR_NOEXIST, + "Invalid LVM ID specified"); return FALSE; } @@ -1812,8 +1812,8 @@ gboolean bd_lvm_add_pv_tags (const gchar *device, const gchar **tags, GError **e return FALSE; if (!pvinfo->vg_name) { - g_set_error (error, BD_LVM_ERROR, BD_LVM_ERROR_FAIL, - "Tags can't be added to PVs without a VG"); + g_set_error_literal (error, BD_LVM_ERROR, BD_LVM_ERROR_FAIL, + "Tags can't be added to PVs without a VG"); bd_lvm_pvdata_free (pvinfo); return FALSE; } @@ -1850,8 +1850,8 @@ gboolean bd_lvm_delete_pv_tags (const gchar *device, const gchar **tags, GError return FALSE; if (!pvinfo->vg_name) { - g_set_error (error, BD_LVM_ERROR, BD_LVM_ERROR_FAIL, - "Tags can't be removed from PVs without a VG"); + g_set_error_literal (error, BD_LVM_ERROR, BD_LVM_ERROR_FAIL, + "Tags can't be removed from PVs without a VG"); bd_lvm_pvdata_free (pvinfo); return FALSE; } @@ -4028,8 +4028,8 @@ gboolean bd_lvm_vdo_pool_resize (const gchar *vg_name, const gchar *pool_name, g return FALSE; if (info->size >= size) { - g_set_error (error, BD_LVM_ERROR, BD_LVM_ERROR_NOT_SUPPORTED, - "Reducing physical size of the VDO pool LV is not supported."); + g_set_error_literal (error, BD_LVM_ERROR, BD_LVM_ERROR_NOT_SUPPORTED, + "Reducing physical size of the VDO pool LV is not supported."); bd_lvm_lvdata_free (info); return FALSE; } diff --git a/src/plugins/lvm/lvm.c b/src/plugins/lvm/lvm.c index f591c68ae..76c4cd7e7 100644 --- a/src/plugins/lvm/lvm.c +++ b/src/plugins/lvm/lvm.c @@ -340,15 +340,15 @@ gboolean bd_lvm_is_tech_avail (BDLVMTech tech, guint64 mode, GError **error) { switch (tech) { case BD_LVM_TECH_THIN_CALCS: if (mode & ~BD_LVM_TECH_MODE_QUERY) { - g_set_error (error, BD_LVM_ERROR, BD_LVM_ERROR_TECH_UNAVAIL, - "Only 'query' supported for thin calculations"); + g_set_error_literal (error, BD_LVM_ERROR, BD_LVM_ERROR_TECH_UNAVAIL, + "Only 'query' supported for thin calculations"); return FALSE; } else return TRUE; case BD_LVM_TECH_CALCS: if (mode & ~BD_LVM_TECH_MODE_QUERY) { - g_set_error (error, BD_LVM_ERROR, BD_LVM_ERROR_TECH_UNAVAIL, - "Only 'query' supported for calculations"); + g_set_error_literal (error, BD_LVM_ERROR, BD_LVM_ERROR_TECH_UNAVAIL, + "Only 'query' supported for calculations"); return FALSE; } else return TRUE; @@ -1130,8 +1130,8 @@ BDLVMPVdata* bd_lvm_pvinfo (const gchar *device, GError **error) { g_strfreev (lines); /* getting here means no usable info was found */ - g_set_error (error, BD_LVM_ERROR, BD_LVM_ERROR_PARSE, - "Failed to parse information about the PV"); + g_set_error_literal (error, BD_LVM_ERROR, BD_LVM_ERROR_PARSE, + "Failed to parse information about the PV"); return NULL; } @@ -1196,8 +1196,8 @@ BDLVMPVdata** bd_lvm_pvs (GError **error) { g_strfreev (lines); if (pvs->len == 0) { - g_set_error (error, BD_LVM_ERROR, BD_LVM_ERROR_PARSE, - "Failed to parse information about PVs"); + g_set_error_literal (error, BD_LVM_ERROR, BD_LVM_ERROR_PARSE, + "Failed to parse information about PVs"); g_ptr_array_free (pvs, TRUE); return NULL; } @@ -1473,8 +1473,8 @@ BDLVMVGdata* bd_lvm_vginfo (const gchar *vg_name, GError **error) { g_strfreev (lines); /* getting here means no usable info was found */ - g_set_error (error, BD_LVM_ERROR, BD_LVM_ERROR_PARSE, - "Failed to parse information about the VG"); + g_set_error_literal (error, BD_LVM_ERROR, BD_LVM_ERROR_PARSE, + "Failed to parse information about the VG"); return NULL; } @@ -1537,8 +1537,8 @@ BDLVMVGdata** bd_lvm_vgs (GError **error) { g_strfreev (lines); if (vgs->len == 0) { - g_set_error (error, BD_LVM_ERROR, BD_LVM_ERROR_PARSE, - "Failed to parse information about VGs"); + g_set_error_literal (error, BD_LVM_ERROR, BD_LVM_ERROR_PARSE, + "Failed to parse information about VGs"); g_ptr_array_free (vgs, TRUE); return NULL; } @@ -1953,8 +1953,8 @@ BDLVMLVdata* bd_lvm_lvinfo (const gchar *vg_name, const gchar *lv_name, GError * g_strfreev (lines); /* getting here means no usable info was found */ - g_set_error (error, BD_LVM_ERROR, BD_LVM_ERROR_PARSE, - "Failed to parse information about the LV"); + g_set_error_literal (error, BD_LVM_ERROR, BD_LVM_ERROR_PARSE, + "Failed to parse information about the LV"); return NULL; } @@ -2001,8 +2001,8 @@ BDLVMLVdata* bd_lvm_lvinfo_tree (const gchar *vg_name, const gchar *lv_name, GEr g_strfreev (lines); if (result == NULL) - g_set_error (error, BD_LVM_ERROR, BD_LVM_ERROR_PARSE, - "Failed to parse information about the LV"); + g_set_error_literal (error, BD_LVM_ERROR, BD_LVM_ERROR_PARSE, + "Failed to parse information about the LV"); return result; } @@ -2086,8 +2086,8 @@ BDLVMLVdata** bd_lvm_lvs (const gchar *vg_name, GError **error) { g_strfreev (lines); if (lvs->len == 0) { - g_set_error (error, BD_LVM_ERROR, BD_LVM_ERROR_PARSE, - "Failed to parse information about LVs"); + g_set_error_literal (error, BD_LVM_ERROR, BD_LVM_ERROR_PARSE, + "Failed to parse information about LVs"); g_ptr_array_free (lvs, TRUE); return NULL; } @@ -2165,8 +2165,8 @@ BDLVMLVdata** bd_lvm_lvs_tree (const gchar *vg_name, GError **error) { g_strfreev (lines); if (lvs->len == 0) { - g_set_error (error, BD_LVM_ERROR, BD_LVM_ERROR_PARSE, - "Failed to parse information about LVs"); + g_set_error_literal (error, BD_LVM_ERROR, BD_LVM_ERROR_PARSE, + "Failed to parse information about LVs"); g_ptr_array_free (lvs, TRUE); return NULL; } @@ -2992,8 +2992,8 @@ BDLVMVDOPooldata* bd_lvm_vdo_info (const gchar *vg_name, const gchar *lv_name, G g_strfreev (lines); /* getting here means no usable info was found */ - g_set_error (error, BD_LVM_ERROR, BD_LVM_ERROR_PARSE, - "Failed to parse information about the VDO LV"); + g_set_error_literal (error, BD_LVM_ERROR, BD_LVM_ERROR_PARSE, + "Failed to parse information about the VDO LV"); return NULL; } @@ -3040,8 +3040,8 @@ gboolean bd_lvm_vdo_pool_resize (const gchar *vg_name, const gchar *pool_name, g return FALSE; if (info->size >= size) { - g_set_error (error, BD_LVM_ERROR, BD_LVM_ERROR_NOT_SUPPORTED, - "Reducing physical size of the VDO pool LV is not supported."); + g_set_error_literal (error, BD_LVM_ERROR, BD_LVM_ERROR_NOT_SUPPORTED, + "Reducing physical size of the VDO pool LV is not supported."); bd_lvm_lvdata_free (info); return FALSE; } diff --git a/src/plugins/lvm/vdo_stats.c b/src/plugins/lvm/vdo_stats.c index 5760cddce..aad1ba625 100644 --- a/src/plugins/lvm/vdo_stats.c +++ b/src/plugins/lvm/vdo_stats.c @@ -153,43 +153,43 @@ vdo_get_stats_full (const gchar *name, GError **error) { dmt = dm_task_create (DM_DEVICE_TARGET_MSG); if (!dmt) { - g_set_error (error, BD_LVM_ERROR, BD_LVM_ERROR_DM_ERROR, - "Failed to create DM task"); + g_set_error_literal (error, BD_LVM_ERROR, BD_LVM_ERROR_DM_ERROR, + "Failed to create DM task"); return NULL; } if (!dm_task_set_name (dmt, name)) { - g_set_error (error, BD_LVM_ERROR, BD_LVM_ERROR_DM_ERROR, - "Failed to set name for DM task"); + g_set_error_literal (error, BD_LVM_ERROR, BD_LVM_ERROR_DM_ERROR, + "Failed to set name for DM task"); dm_task_destroy (dmt); return NULL; } if (!dm_task_set_message (dmt, "stats")) { - g_set_error (error, BD_LVM_ERROR, BD_LVM_ERROR_DM_ERROR, - "Failed to set message for DM task"); + g_set_error_literal (error, BD_LVM_ERROR, BD_LVM_ERROR_DM_ERROR, + "Failed to set message for DM task"); dm_task_destroy (dmt); return NULL; } if (!dm_task_run (dmt)) { - g_set_error (error, BD_LVM_ERROR, BD_LVM_ERROR_DM_ERROR, - "Failed to run DM task"); + g_set_error_literal (error, BD_LVM_ERROR, BD_LVM_ERROR_DM_ERROR, + "Failed to run DM task"); dm_task_destroy (dmt); return NULL; } response = dm_task_get_message_response (dmt); if (!response) { - g_set_error (error, BD_LVM_ERROR, BD_LVM_ERROR_DM_ERROR, - "Failed to get response from the DM task"); + g_set_error_literal (error, BD_LVM_ERROR, BD_LVM_ERROR_DM_ERROR, + "Failed to get response from the DM task"); dm_task_destroy (dmt); return NULL; } if (!yaml_parser_initialize (&parser)) { - g_set_error (error, BD_LVM_ERROR, BD_LVM_ERROR_DM_ERROR, - "Failed to get initialize YAML parser"); + g_set_error_literal (error, BD_LVM_ERROR, BD_LVM_ERROR_DM_ERROR, + "Failed to get initialize YAML parser"); dm_task_destroy (dmt); return NULL; } diff --git a/src/plugins/mdraid.c b/src/plugins/mdraid.c index 1a1de32dd..943efaf46 100644 --- a/src/plugins/mdraid.c +++ b/src/plugins/mdraid.c @@ -958,7 +958,7 @@ BDMDExamineData* bd_md_examine (const gchar *device, GError **error) { g_free (output); if (!table || (num_items == 0)) { /* something bad happened */ - g_set_error (error, BD_MD_ERROR, BD_MD_ERROR_PARSE, "Failed to parse mdexamine data"); + g_set_error_literal (error, BD_MD_ERROR, BD_MD_ERROR_PARSE, "Failed to parse mdexamine data"); if (table) g_hash_table_destroy (table); return NULL; @@ -966,7 +966,7 @@ BDMDExamineData* bd_md_examine (const gchar *device, GError **error) { ret = get_examine_data_from_table (table, TRUE); if (!ret) { - g_set_error (error, BD_MD_ERROR, BD_MD_ERROR_PARSE, "Failed to get mdexamine data"); + g_set_error_literal (error, BD_MD_ERROR, BD_MD_ERROR_PARSE, "Failed to get mdexamine data"); if (table) g_hash_table_destroy (table); return NULL; @@ -1056,8 +1056,8 @@ BDMDExamineData* bd_md_examine (const gchar *device, GError **error) { g_free (output); if (!table) { /* something bad happened or some expected items were missing */ - g_set_error (error, BD_MD_ERROR, BD_MD_ERROR_PARSE, - "Failed to parse mdexamine metadata"); + g_set_error_literal (error, BD_MD_ERROR, BD_MD_ERROR_PARSE, + "Failed to parse mdexamine metadata"); bd_md_examine_data_free (ret); return NULL; } @@ -1115,7 +1115,7 @@ BDMDDetailData* bd_md_detail (const gchar *raid_spec, GError **error) { g_free (output); if (!table || (num_items == 0)) { /* something bad happened or some expected items were missing */ - g_set_error (error, BD_MD_ERROR, BD_MD_ERROR_PARSE, "Failed to parse mddetail data"); + g_set_error_literal (error, BD_MD_ERROR, BD_MD_ERROR_PARSE, "Failed to parse mddetail data"); if (table) g_hash_table_destroy (table); return NULL; @@ -1123,7 +1123,7 @@ BDMDDetailData* bd_md_detail (const gchar *raid_spec, GError **error) { ret = get_detail_data_from_table (table, TRUE); if (!ret) { - g_set_error (error, BD_MD_ERROR, BD_MD_ERROR_PARSE, "Failed to get mddetail data"); + g_set_error_literal (error, BD_MD_ERROR, BD_MD_ERROR_PARSE, "Failed to get mddetail data"); return NULL; } @@ -1458,8 +1458,8 @@ gboolean bd_md_set_bitmap_location (const gchar *raid_spec, const gchar *locatio if ((g_strcmp0 (location, "none") != 0) && (g_strcmp0 (location, "internal") != 0) && !g_str_has_prefix (location , "/")) { - g_set_error (error, BD_MD_ERROR, BD_MD_ERROR_INVAL, - "Bitmap location must start with '/' or be 'internal' or 'none'."); + g_set_error_literal (error, BD_MD_ERROR, BD_MD_ERROR_INVAL, + "Bitmap location must start with '/' or be 'internal' or 'none'."); g_free (mdadm_spec); return FALSE; } @@ -1528,8 +1528,8 @@ gboolean bd_md_request_sync_action (const gchar *raid_spec, const gchar *action, (g_strcmp0 (action, "check") != 0) && (g_strcmp0 (action, "repair") != 0) && (g_strcmp0 (action, "idle") != 0)) { - g_set_error (error, BD_MD_ERROR, BD_MD_ERROR_INVAL, - "Action must be one of resync, recovery, check, repair or idle."); + g_set_error_literal (error, BD_MD_ERROR, BD_MD_ERROR_INVAL, + "Action must be one of resync, recovery, check, repair or idle."); return FALSE; } diff --git a/src/plugins/mpath.c b/src/plugins/mpath.c index 6a62d010e..f14fff56d 100644 --- a/src/plugins/mpath.c +++ b/src/plugins/mpath.c @@ -99,18 +99,18 @@ gboolean bd_mpath_is_tech_avail (BDMpathTech tech, guint64 mode, GError **error) return check_deps (&avail_deps, DEPS_MPATH_MASK, deps, DEPS_LAST, &deps_check_lock, error); case BD_MPATH_TECH_FRIENDLY_NAMES: if (mode & ~BD_MPATH_TECH_MODE_MODIFY) { - g_set_error (error, BD_MPATH_ERROR, BD_MPATH_ERROR_TECH_UNAVAIL, - "Only 'modify' (setting) supported for friendly names"); + g_set_error_literal (error, BD_MPATH_ERROR, BD_MPATH_ERROR_TECH_UNAVAIL, + "Only 'modify' (setting) supported for friendly names"); return FALSE; } else if (mode & BD_MPATH_TECH_MODE_MODIFY) return check_deps (&avail_deps, DEPS_MPATHCONF_MASK, deps, DEPS_LAST, &deps_check_lock, error); else { - g_set_error (error, BD_MPATH_ERROR, BD_MPATH_ERROR_TECH_UNAVAIL, - "Unknown mode"); + g_set_error_literal (error, BD_MPATH_ERROR, BD_MPATH_ERROR_TECH_UNAVAIL, + "Unknown mode"); return FALSE; } default: - g_set_error (error, BD_MPATH_ERROR, BD_MPATH_ERROR_TECH_UNAVAIL, "Unknown technology"); + g_set_error_literal (error, BD_MPATH_ERROR, BD_MPATH_ERROR_TECH_UNAVAIL, "Unknown technology"); return FALSE; } } @@ -199,28 +199,28 @@ static gboolean map_is_multipath (const gchar *map_name, GError **error) { task = dm_task_create (DM_DEVICE_STATUS); if (!task) { bd_utils_log_format (BD_UTILS_LOG_WARNING, "Failed to create DM task"); - g_set_error (error, BD_MPATH_ERROR, BD_MPATH_ERROR_DM_ERROR, - "Failed to create DM task"); + g_set_error_literal (error, BD_MPATH_ERROR, BD_MPATH_ERROR_DM_ERROR, + "Failed to create DM task"); return FALSE; } if (dm_task_set_name (task, map_name) == 0) { - g_set_error (error, BD_MPATH_ERROR, BD_MPATH_ERROR_DM_ERROR, - "Failed to create DM task"); + g_set_error_literal (error, BD_MPATH_ERROR, BD_MPATH_ERROR_DM_ERROR, + "Failed to create DM task"); dm_task_destroy (task); return FALSE; } if (dm_task_run (task) == 0) { - g_set_error (error, BD_MPATH_ERROR, BD_MPATH_ERROR_DM_ERROR, - "Failed to run DM task"); + g_set_error_literal (error, BD_MPATH_ERROR, BD_MPATH_ERROR_DM_ERROR, + "Failed to run DM task"); dm_task_destroy (task); return FALSE; } if (dm_task_get_info (task, &info) == 0) { - g_set_error (error, BD_MPATH_ERROR, BD_MPATH_ERROR_DM_ERROR, - "Failed to get task info"); + g_set_error_literal (error, BD_MPATH_ERROR, BD_MPATH_ERROR_DM_ERROR, + "Failed to get task info"); dm_task_destroy (task); return FALSE; } @@ -248,29 +248,29 @@ static gchar** get_map_deps (const gchar *map_name, guint64 *n_deps, GError **er task = dm_task_create (DM_DEVICE_DEPS); if (!task) { bd_utils_log_format (BD_UTILS_LOG_WARNING, "Failed to create DM task"); - g_set_error (error, BD_MPATH_ERROR, BD_MPATH_ERROR_DM_ERROR, - "Failed to create DM task"); + g_set_error_literal (error, BD_MPATH_ERROR, BD_MPATH_ERROR_DM_ERROR, + "Failed to create DM task"); return NULL; } if (dm_task_set_name (task, map_name) == 0) { - g_set_error (error, BD_MPATH_ERROR, BD_MPATH_ERROR_DM_ERROR, - "Failed to create DM task"); + g_set_error_literal (error, BD_MPATH_ERROR, BD_MPATH_ERROR_DM_ERROR, + "Failed to create DM task"); dm_task_destroy (task); return NULL; } if (dm_task_run (task) == 0) { - g_set_error (error, BD_MPATH_ERROR, BD_MPATH_ERROR_DM_ERROR, - "Failed to run DM task"); + g_set_error_literal (error, BD_MPATH_ERROR, BD_MPATH_ERROR_DM_ERROR, + "Failed to run DM task"); dm_task_destroy (task); return NULL; } deps = dm_task_get_deps (task); if (!deps) { - g_set_error (error, BD_MPATH_ERROR, BD_MPATH_ERROR_DM_ERROR, - "Failed to device dependencies"); + g_set_error_literal (error, BD_MPATH_ERROR, BD_MPATH_ERROR_DM_ERROR, + "Failed to get device dependencies"); dm_task_destroy (task); return NULL; } @@ -325,8 +325,8 @@ gboolean bd_mpath_is_mpath_member (const gchar *device, GError **error) { task_names = dm_task_create (DM_DEVICE_LIST); if (!task_names) { bd_utils_log_format (BD_UTILS_LOG_WARNING, "Failed to create DM task"); - g_set_error (error, BD_MPATH_ERROR, BD_MPATH_ERROR_DM_ERROR, - "Failed to create DM task"); + g_set_error_literal (error, BD_MPATH_ERROR, BD_MPATH_ERROR_DM_ERROR, + "Failed to create DM task"); return FALSE; } @@ -422,8 +422,8 @@ gchar** bd_mpath_get_mpath_members (GError **error) { task_names = dm_task_create (DM_DEVICE_LIST); if (!task_names) { bd_utils_log_format (BD_UTILS_LOG_WARNING, "Failed to create DM task"); - g_set_error (&l_error, BD_MPATH_ERROR, BD_MPATH_ERROR_DM_ERROR, - "Failed to create DM task"); + g_set_error_literal (&l_error, BD_MPATH_ERROR, BD_MPATH_ERROR_DM_ERROR, + "Failed to create DM task"); bd_utils_report_finished (progress_id, l_error->message); g_propagate_error (error, l_error); return NULL; diff --git a/src/plugins/nvdimm.c b/src/plugins/nvdimm.c index 81616b559..f6b2bea3f 100644 --- a/src/plugins/nvdimm.c +++ b/src/plugins/nvdimm.c @@ -131,7 +131,7 @@ gboolean bd_nvdimm_is_tech_avail (BDNVDIMMTech tech, guint64 mode, GError **erro else return TRUE; } else { - g_set_error (error, BD_NVDIMM_ERROR, BD_NVDIMM_ERROR_TECH_UNAVAIL, "Unknown technology"); + g_set_error_literal (error, BD_NVDIMM_ERROR, BD_NVDIMM_ERROR_TECH_UNAVAIL, "Unknown technology"); return FALSE; } @@ -234,8 +234,8 @@ gchar* bd_nvdimm_namespace_get_devname (const gchar *device, GError **error) { success = ndctl_new (&ctx); if (success != 0) { - g_set_error (error, BD_NVDIMM_ERROR, BD_NVDIMM_ERROR_NAMESPACE_FAIL, - "Failed to create ndctl context"); + g_set_error_literal (error, BD_NVDIMM_ERROR, BD_NVDIMM_ERROR_NAMESPACE_FAIL, + "Failed to create ndctl context"); return NULL; } @@ -291,8 +291,8 @@ gboolean bd_nvdimm_namespace_enable (const gchar *namespace, const BDExtraArg ** ret = ndctl_new (&ctx); if (ret != 0) { - g_set_error (error, BD_NVDIMM_ERROR, BD_NVDIMM_ERROR_NAMESPACE_FAIL, - "Failed to create ndctl context"); + g_set_error_literal (error, BD_NVDIMM_ERROR, BD_NVDIMM_ERROR_NAMESPACE_FAIL, + "Failed to create ndctl context"); return FALSE; } @@ -334,8 +334,8 @@ gboolean bd_nvdimm_namespace_disable (const gchar *namespace, const BDExtraArg * ret = ndctl_new (&ctx); if (ret != 0) { - g_set_error (error, BD_NVDIMM_ERROR, BD_NVDIMM_ERROR_NAMESPACE_FAIL, - "Failed to create ndctl context"); + g_set_error_literal (error, BD_NVDIMM_ERROR, BD_NVDIMM_ERROR_NAMESPACE_FAIL, + "Failed to create ndctl context"); return FALSE; } @@ -389,9 +389,9 @@ static BDNVDIMMNamespaceInfo* get_nvdimm_namespace_info (struct ndctl_namespace break; case NDCTL_NS_MODE_DAX: if (!dax) { - g_set_error (error, BD_NVDIMM_ERROR, BD_NVDIMM_ERROR_NAMESPACE_FAIL, - "Failed to get information about namespaces: DAX mode " - "detected but no DAX device found."); + g_set_error_literal (error, BD_NVDIMM_ERROR, BD_NVDIMM_ERROR_NAMESPACE_FAIL, + "Failed to get information about namespaces: DAX mode " + "detected but no DAX device found."); bd_nvdimm_namespace_info_free (info); return NULL; } @@ -404,9 +404,9 @@ static BDNVDIMMNamespaceInfo* get_nvdimm_namespace_info (struct ndctl_namespace break; case NDCTL_NS_MODE_SAFE: if (!btt) { - g_set_error (error, BD_NVDIMM_ERROR, BD_NVDIMM_ERROR_NAMESPACE_FAIL, - "Failed to get information about namespaces: Sector mode " - "detected but no BTT device found."); + g_set_error_literal (error, BD_NVDIMM_ERROR, BD_NVDIMM_ERROR_NAMESPACE_FAIL, + "Failed to get information about namespaces: Sector mode " + "detected but no BTT device found."); bd_nvdimm_namespace_info_free (info); return NULL; } @@ -418,8 +418,8 @@ static BDNVDIMMNamespaceInfo* get_nvdimm_namespace_info (struct ndctl_namespace info->mode = BD_NVDIMM_NAMESPACE_MODE_RAW; break; default: - g_set_error (error, BD_NVDIMM_ERROR, BD_NVDIMM_ERROR_NAMESPACE_FAIL, - "Failed to get information about namespaces: Unknown mode."); + g_set_error_literal (error, BD_NVDIMM_ERROR, BD_NVDIMM_ERROR_NAMESPACE_FAIL, + "Failed to get information about namespaces: Unknown mode."); bd_nvdimm_namespace_info_free (info); return NULL; } @@ -499,8 +499,8 @@ BDNVDIMMNamespaceInfo* bd_nvdimm_namespace_info (const gchar *namespace, const B ret = ndctl_new (&ctx); if (ret != 0) { - g_set_error (error, BD_NVDIMM_ERROR, BD_NVDIMM_ERROR_NAMESPACE_FAIL, - "Failed to create ndctl context"); + g_set_error_literal (error, BD_NVDIMM_ERROR, BD_NVDIMM_ERROR_NAMESPACE_FAIL, + "Failed to create ndctl context"); return NULL; } @@ -545,8 +545,8 @@ BDNVDIMMNamespaceInfo** bd_nvdimm_list_namespaces (const gchar *bus_name, const ret = ndctl_new (&ctx); if (ret != 0) { - g_set_error (error, BD_NVDIMM_ERROR, BD_NVDIMM_ERROR_NAMESPACE_FAIL, - "Failed to create ndctl context"); + g_set_error_literal (error, BD_NVDIMM_ERROR, BD_NVDIMM_ERROR_NAMESPACE_FAIL, + "Failed to create ndctl context"); return NULL; } @@ -658,8 +658,8 @@ const guint64 *bd_nvdimm_namespace_get_supported_sector_sizes (BDNVDIMMNamespace return blk_sector_sizes; default: - g_set_error (error, BD_NVDIMM_ERROR, BD_NVDIMM_ERROR_NAMESPACE_MODE_INVAL, - "Invalid/unknown mode specified."); + g_set_error_literal (error, BD_NVDIMM_ERROR, BD_NVDIMM_ERROR_NAMESPACE_MODE_INVAL, + "Invalid/unknown mode specified."); return NULL; } } diff --git a/src/plugins/nvme/nvme-op.c b/src/plugins/nvme/nvme-op.c index 6360a1887..90e64ca32 100644 --- a/src/plugins/nvme/nvme-op.c +++ b/src/plugins/nvme/nvme-op.c @@ -237,7 +237,7 @@ gboolean bd_nvme_format (const gchar *device, guint16 lba_data_size, guint16 met /* tell user that it would format other namespaces and that bd_nvme_format() * should be called on a controller device instead */ g_set_error_literal (error, BD_NVME_ERROR, BD_NVME_ERROR_WOULD_FORMAT_ALL_NS, - "The NVMe controller indicates it would format all namespaces."); + "The NVMe controller indicates it would format all namespaces."); close (args.fd); free (ctrl_id); return FALSE; diff --git a/src/plugins/nvme/nvme.c b/src/plugins/nvme/nvme.c index c319f088c..3641fc811 100644 --- a/src/plugins/nvme/nvme.c +++ b/src/plugins/nvme/nvme.c @@ -83,7 +83,7 @@ gboolean bd_nvme_is_tech_avail (BDNVMETech tech, G_GNUC_UNUSED guint64 mode, GEr case BD_NVME_TECH_FABRICS: return TRUE; default: - g_set_error (error, BD_NVME_ERROR, BD_NVME_ERROR_TECH_UNAVAIL, "Unknown technology"); + g_set_error_literal (error, BD_NVME_ERROR, BD_NVME_ERROR_TECH_UNAVAIL, "Unknown technology"); return FALSE; } } diff --git a/src/plugins/part.c b/src/plugins/part.c index 03a5c8564..b19d0000a 100644 --- a/src/plugins/part.c +++ b/src/plugins/part.c @@ -194,8 +194,8 @@ static struct fdisk_context* get_device_context (const gchar *disk, gboolean rea gint ret = 0; if (!cxt) { - g_set_error (error, BD_PART_ERROR, BD_PART_ERROR_FAIL, - "Failed to create a new context"); + g_set_error_literal (error, BD_PART_ERROR, BD_PART_ERROR_FAIL, + "Failed to create a new context"); return NULL; } @@ -329,7 +329,7 @@ gboolean bd_part_is_tech_avail (BDPartTech tech, guint64 mode G_GNUC_UNUSED, GEr * plugin, nothing extra is needed */ return TRUE; default: - g_set_error (error, BD_PART_ERROR, BD_PART_ERROR_TECH_UNAVAIL, "Unknown technology"); + g_set_error_literal (error, BD_PART_ERROR, BD_PART_ERROR_TECH_UNAVAIL, "Unknown technology"); return FALSE; } } @@ -436,8 +436,8 @@ static gchar* get_part_type_guid_and_gpt_flags (const gchar *device, int part_nu if (attrs) { status = fdisk_gpt_get_partition_attrs (cxt, part_num, attrs); if (status < 0) { - g_set_error (error, BD_PART_ERROR, BD_PART_ERROR_FAIL, - "Failed to read GPT attributes"); + g_set_error_literal (error, BD_PART_ERROR, BD_PART_ERROR_FAIL, + "Failed to read GPT attributes"); close_context (cxt); return NULL; } @@ -537,8 +537,8 @@ static BDPartSpec* get_part_spec_fdisk (struct fdisk_context *cxt, struct fdisk_ lb = fdisk_get_label (cxt, NULL); if (!lb) { - g_set_error (error, BD_PART_ERROR, BD_PART_ERROR_FAIL, - "Failed to read partition table."); + g_set_error_literal (error, BD_PART_ERROR, BD_PART_ERROR_FAIL, + "Failed to read partition table."); bd_part_spec_free (ret); return NULL; } @@ -559,8 +559,8 @@ static BDPartSpec* get_part_spec_fdisk (struct fdisk_context *cxt, struct fdisk_ if (ret->type == BD_PART_TYPE_NORMAL || ret->type == BD_PART_TYPE_LOGICAL || ret->type == BD_PART_TYPE_EXTENDED) { ptype = fdisk_partition_get_type (pa); if (!ptype) { - g_set_error (error, BD_PART_ERROR, BD_PART_ERROR_FAIL, - "Failed to get partition type."); + g_set_error_literal (error, BD_PART_ERROR, BD_PART_ERROR_FAIL, + "Failed to get partition type."); bd_part_spec_free (ret); return NULL; } @@ -637,16 +637,16 @@ static BDPartSpec** get_disk_parts (const gchar *disk, gboolean parts, gboolean table = fdisk_new_table (); if (!table) { - g_set_error (error, BD_PART_ERROR, BD_PART_ERROR_FAIL, - "Failed to create a new table"); + g_set_error_literal (error, BD_PART_ERROR, BD_PART_ERROR_FAIL, + "Failed to create a new table"); close_context (cxt); return NULL; } itr = fdisk_new_iter (FDISK_ITER_FORWARD); if (!itr) { - g_set_error (error, BD_PART_ERROR, BD_PART_ERROR_FAIL, - "Failed to create a new iterator"); + g_set_error_literal (error, BD_PART_ERROR, BD_PART_ERROR_FAIL, + "Failed to create a new iterator"); close_context (cxt); return NULL; } @@ -654,8 +654,8 @@ static BDPartSpec** get_disk_parts (const gchar *disk, gboolean parts, gboolean if (parts) { status = fdisk_get_partitions (cxt, &table); if (status != 0) { - g_set_error (error, BD_PART_ERROR, BD_PART_ERROR_FAIL, - "Failed to get partitions"); + g_set_error_literal (error, BD_PART_ERROR, BD_PART_ERROR_FAIL, + "Failed to get partitions"); fdisk_free_iter (itr); fdisk_unref_table (table); close_context (cxt); @@ -666,8 +666,8 @@ static BDPartSpec** get_disk_parts (const gchar *disk, gboolean parts, gboolean if (freespaces) { status = fdisk_get_freespaces (cxt, &table); if (status != 0) { - g_set_error (error, BD_PART_ERROR, BD_PART_ERROR_FAIL, - "Failed to get free spaces"); + g_set_error_literal (error, BD_PART_ERROR, BD_PART_ERROR_FAIL, + "Failed to get free spaces"); fdisk_free_iter (itr); fdisk_unref_table (table); close_context (cxt); @@ -678,8 +678,8 @@ static BDPartSpec** get_disk_parts (const gchar *disk, gboolean parts, gboolean /* sort partitions by start */ status = fdisk_table_sort_partitions (table, fdisk_partition_cmp_start); if (status != 0) { - g_set_error (error, BD_PART_ERROR, BD_PART_ERROR_FAIL, - "Failed to sort partitions"); + g_set_error_literal (error, BD_PART_ERROR, BD_PART_ERROR_FAIL, + "Failed to sort partitions"); fdisk_free_iter (itr); fdisk_unref_table (table); close_context (cxt); @@ -1000,8 +1000,8 @@ BDPartSpec* bd_part_create_part (const gchar *disk, BDPartTypeReq type, guint64 npa = fdisk_new_partition (); if (!npa) { - g_set_error (&l_error, BD_PART_ERROR, BD_PART_ERROR_FAIL, - "Failed to create new partition object"); + g_set_error_literal (&l_error, BD_PART_ERROR, BD_PART_ERROR_FAIL, + "Failed to create new partition object"); fdisk_unref_table (table); close_context (cxt); bd_utils_report_finished (progress_id, l_error->message); @@ -1020,8 +1020,8 @@ BDPartSpec* bd_part_create_part (const gchar *disk, BDPartTypeReq type, guint64 status = fdisk_save_user_grain (cxt, grain_size); if (status != 0) { - g_set_error (&l_error, BD_PART_ERROR, BD_PART_ERROR_FAIL, - "Failed to setup alignment"); + g_set_error_literal (&l_error, BD_PART_ERROR, BD_PART_ERROR_FAIL, + "Failed to setup alignment"); fdisk_unref_table (table); close_context (cxt); bd_utils_report_finished (progress_id, l_error->message); @@ -1033,8 +1033,8 @@ BDPartSpec* bd_part_create_part (const gchar *disk, BDPartTypeReq type, guint64 * effective */ status = fdisk_reset_device_properties (cxt); if (status != 0) { - g_set_error (&l_error, BD_PART_ERROR, BD_PART_ERROR_FAIL, - "Failed to setup alignment"); + g_set_error_literal (&l_error, BD_PART_ERROR, BD_PART_ERROR_FAIL, + "Failed to setup alignment"); fdisk_unref_table (table); close_context (cxt); bd_utils_report_finished (progress_id, l_error->message); @@ -1074,8 +1074,8 @@ BDPartSpec* bd_part_create_part (const gchar *disk, BDPartTypeReq type, guint64 size = end - start; if (fdisk_partition_set_size (npa, size) != 0) { - g_set_error (&l_error, BD_PART_ERROR, BD_PART_ERROR_FAIL, - "Failed to set partition size"); + g_set_error_literal (&l_error, BD_PART_ERROR, BD_PART_ERROR_FAIL, + "Failed to set partition size"); fdisk_unref_table (table); fdisk_unref_partition (npa); close_context (cxt); @@ -1094,8 +1094,8 @@ BDPartSpec* bd_part_create_part (const gchar *disk, BDPartTypeReq type, guint64 type = BD_PART_TYPE_REQ_NORMAL; if (on_gpt && type != BD_PART_TYPE_REQ_NORMAL) { - g_set_error (&l_error, BD_PART_ERROR, BD_PART_ERROR_FAIL, - "Only normal partitions are supported on GPT."); + g_set_error_literal (&l_error, BD_PART_ERROR, BD_PART_ERROR_FAIL, + "Only normal partitions are supported on GPT."); fdisk_unref_table (table); fdisk_unref_partition (npa); close_context (cxt); @@ -1125,8 +1125,8 @@ BDPartSpec* bd_part_create_part (const gchar *disk, BDPartTypeReq type, guint64 else { /* trying to create a partition inside an existing one, but not an extended one -> error */ - g_set_error (&l_error, BD_PART_ERROR, BD_PART_ERROR_INVAL, - "Cannot create a partition inside an existing non-extended one"); + g_set_error_literal (&l_error, BD_PART_ERROR, BD_PART_ERROR_INVAL, + "Cannot create a partition inside an existing non-extended one"); fdisk_unref_partition (npa); fdisk_free_iter (iter); fdisk_unref_table (table); @@ -1146,8 +1146,8 @@ BDPartSpec* bd_part_create_part (const gchar *disk, BDPartTypeReq type, guint64 new_extended = TRUE; n_epa = fdisk_new_partition (); if (!n_epa) { - g_set_error (&l_error, BD_PART_ERROR, BD_PART_ERROR_FAIL, - "Failed to create new partition object"); + g_set_error_literal (&l_error, BD_PART_ERROR, BD_PART_ERROR_FAIL, + "Failed to create new partition object"); fdisk_unref_partition (npa); close_context (cxt); bd_utils_report_finished (progress_id, l_error->message); @@ -1155,8 +1155,8 @@ BDPartSpec* bd_part_create_part (const gchar *disk, BDPartTypeReq type, guint64 return NULL; } if (fdisk_partition_set_start (n_epa, start) != 0) { - g_set_error (&l_error, BD_PART_ERROR, BD_PART_ERROR_FAIL, - "Failed to set partition start"); + g_set_error_literal (&l_error, BD_PART_ERROR, BD_PART_ERROR_FAIL, + "Failed to set partition start"); fdisk_unref_partition (n_epa); fdisk_unref_partition (npa); fdisk_free_iter (iter); @@ -1171,8 +1171,8 @@ BDPartSpec* bd_part_create_part (const gchar *disk, BDPartTypeReq type, guint64 status = fdisk_partition_next_partno (npa, cxt, &partno); if (status != 0) { - g_set_error (&l_error, BD_PART_ERROR, BD_PART_ERROR_FAIL, - "Failed to get new extended partition number"); + g_set_error_literal (&l_error, BD_PART_ERROR, BD_PART_ERROR_FAIL, + "Failed to get new extended partition number"); fdisk_unref_partition (npa); close_context (cxt); bd_utils_report_finished (progress_id, l_error->message); @@ -1182,8 +1182,8 @@ BDPartSpec* bd_part_create_part (const gchar *disk, BDPartTypeReq type, guint64 status = fdisk_partition_set_partno (npa, partno); if (status != 0) { - g_set_error (&l_error, BD_PART_ERROR, BD_PART_ERROR_FAIL, - "Failed to set new extended partition number"); + g_set_error_literal (&l_error, BD_PART_ERROR, BD_PART_ERROR_FAIL, + "Failed to set new extended partition number"); fdisk_unref_partition (npa); close_context (cxt); bd_utils_report_finished (progress_id, l_error->message); @@ -1197,8 +1197,8 @@ BDPartSpec* bd_part_create_part (const gchar *disk, BDPartTypeReq type, guint64 /* "05" for extended partition */ ptype = fdisk_label_parse_parttype (fdisk_get_label (cxt, NULL), "05"); if (fdisk_partition_set_type (n_epa, ptype) != 0) { - g_set_error (&l_error, BD_PART_ERROR, BD_PART_ERROR_FAIL, - "Failed to set partition type"); + g_set_error_literal (&l_error, BD_PART_ERROR, BD_PART_ERROR_FAIL, + "Failed to set partition type"); fdisk_unref_partition (n_epa); fdisk_unref_partition (npa); fdisk_free_iter (iter); @@ -1240,8 +1240,8 @@ BDPartSpec* bd_part_create_part (const gchar *disk, BDPartTypeReq type, guint64 /* "05" for extended partition */ ptype = fdisk_label_parse_parttype (fdisk_get_label (cxt, NULL), "05"); if (fdisk_partition_set_type (npa, ptype) != 0) { - g_set_error (&l_error, BD_PART_ERROR, BD_PART_ERROR_FAIL, - "Failed to set partition type"); + g_set_error_literal (&l_error, BD_PART_ERROR, BD_PART_ERROR_FAIL, + "Failed to set partition type"); fdisk_unref_table (table); fdisk_unref_partition (npa); close_context (cxt); @@ -1254,8 +1254,8 @@ BDPartSpec* bd_part_create_part (const gchar *disk, BDPartTypeReq type, guint64 } if (fdisk_partition_set_start (npa, start) != 0) { - g_set_error (&l_error, BD_PART_ERROR, BD_PART_ERROR_FAIL, - "Failed to set partition start"); + g_set_error_literal (&l_error, BD_PART_ERROR, BD_PART_ERROR_FAIL, + "Failed to set partition start"); fdisk_unref_table (table); fdisk_unref_partition (npa); close_context (cxt); @@ -1273,8 +1273,8 @@ BDPartSpec* bd_part_create_part (const gchar *disk, BDPartTypeReq type, guint64 } else { status = fdisk_partition_next_partno (npa, cxt, &partno); if (status != 0) { - g_set_error (&l_error, BD_PART_ERROR, BD_PART_ERROR_FAIL, - "Failed to get new partition number"); + g_set_error_literal (&l_error, BD_PART_ERROR, BD_PART_ERROR_FAIL, + "Failed to get new partition number"); fdisk_unref_table (table); fdisk_unref_partition (npa); close_context (cxt); @@ -1286,8 +1286,8 @@ BDPartSpec* bd_part_create_part (const gchar *disk, BDPartTypeReq type, guint64 status = fdisk_partition_set_partno (npa, partno); if (status != 0) { - g_set_error (&l_error, BD_PART_ERROR, BD_PART_ERROR_FAIL, - "Failed to set new partition number"); + g_set_error_literal (&l_error, BD_PART_ERROR, BD_PART_ERROR_FAIL, + "Failed to set new partition number"); fdisk_unref_table (table); fdisk_unref_partition (npa); close_context (cxt); @@ -1432,8 +1432,8 @@ static gboolean get_max_part_size (struct fdisk_table *tb, guint partno, guint64 itr = fdisk_new_iter (FDISK_ITER_FORWARD); if (!itr) { - g_set_error (error, BD_PART_ERROR, BD_PART_ERROR_FAIL, - "Failed to create a new iterator"); + g_set_error_literal (error, BD_PART_ERROR, BD_PART_ERROR_FAIL, + "Failed to create a new iterator"); return FALSE; } @@ -1678,8 +1678,8 @@ gboolean bd_part_resize_part (const gchar *disk, const gchar *part, guint64 size } if (fdisk_partition_set_size (pa, size) != 0) { - g_set_error (&l_error, BD_PART_ERROR, BD_PART_ERROR_FAIL, - "Failed to set partition size"); + g_set_error_literal (&l_error, BD_PART_ERROR, BD_PART_ERROR_FAIL, + "Failed to set partition size"); fdisk_unref_table (table); fdisk_unref_partition (pa); close_context (cxt); @@ -1741,16 +1741,16 @@ static gboolean set_part_type (struct fdisk_context *cxt, gint part_num, const g } if (part_id_int == 0x05 || part_id_int == 0x0f || part_id_int == 0x85) { - g_set_error (error, BD_PART_ERROR, BD_PART_ERROR_INVAL, - "Cannot change partition id to extended."); + g_set_error_literal (error, BD_PART_ERROR, BD_PART_ERROR_INVAL, + "Cannot change partition id to extended."); return FALSE; } } lb = fdisk_get_label (cxt, NULL); if (!lb) { - g_set_error (error, BD_PART_ERROR, BD_PART_ERROR_FAIL, - "Failed to read partition table."); + g_set_error_literal (error, BD_PART_ERROR, BD_PART_ERROR_FAIL, + "Failed to read partition table."); return FALSE; } @@ -1770,8 +1770,8 @@ static gboolean set_part_type (struct fdisk_context *cxt, gint part_num, const g ptype = fdisk_label_parse_parttype (lb, type_str); if (!ptype) { - g_set_error (error, BD_PART_ERROR, BD_PART_ERROR_INVAL, - "Failed to parse partition type."); + g_set_error_literal (error, BD_PART_ERROR, BD_PART_ERROR_INVAL, + "Failed to parse partition type."); fdisk_unref_partition (pa); return FALSE; } @@ -2281,8 +2281,8 @@ gboolean bd_part_set_part_attributes (const gchar *disk, const gchar *part, guin */ const gchar* bd_part_get_part_table_type_str (BDPartTableType type, GError **error) { if (type >= BD_PART_TABLE_UNDEF) { - g_set_error (error, BD_PART_ERROR, BD_PART_ERROR_INVAL, - "Invalid partition table type given"); + g_set_error_literal (error, BD_PART_ERROR, BD_PART_ERROR_INVAL, + "Invalid partition table type given"); return NULL; } @@ -2303,7 +2303,7 @@ static const gchar* const part_types[6] = { "primary", "logical", "extended", "f */ const gchar* bd_part_get_type_str (BDPartType type, GError **error) { if (type > BD_PART_TYPE_PROTECTED) { - g_set_error (error, BD_PART_ERROR, BD_PART_ERROR_INVAL, "Invalid partition type given"); + g_set_error_literal (error, BD_PART_ERROR, BD_PART_ERROR_INVAL, "Invalid partition type given"); return NULL; } diff --git a/src/plugins/s390.c b/src/plugins/s390.c index 15b0644ed..0df102f7b 100644 --- a/src/plugins/s390.c +++ b/src/plugins/s390.c @@ -105,7 +105,7 @@ gboolean bd_s390_is_tech_avail (BDS390Tech tech, guint64 mode, GError **error) { else return TRUE; default: - g_set_error (error, BD_S390_ERROR, BD_S390_ERROR_TECH_UNAVAIL, "Unknown technology"); + g_set_error_literal (error, BD_S390_ERROR, BD_S390_ERROR_TECH_UNAVAIL, "Unknown technology"); return FALSE; } } @@ -400,8 +400,8 @@ gchar* bd_s390_sanitize_dev_input (const gchar *dev, GError **error) { /* first make sure we're not being played */ if ((dev == NULL) || (!*dev)) { - g_set_error (error, BD_S390_ERROR, BD_S390_ERROR_DEVICE, - "Device number not specified or invalid"); + g_set_error_literal (error, BD_S390_ERROR, BD_S390_ERROR_DEVICE, + "Device number not specified or invalid"); return NULL; } @@ -451,8 +451,8 @@ gchar* bd_s390_zfcp_sanitize_wwpn_input (const gchar *wwpn, GError **error) { /* first make sure we're not being played */ if ((wwpn == NULL) || (!*wwpn) || (strlen (wwpn) < 2)) { - g_set_error (error, BD_S390_ERROR, BD_S390_ERROR_DEVICE, - "WWPN not specified or invalid"); + g_set_error_literal (error, BD_S390_ERROR, BD_S390_ERROR_DEVICE, + "WWPN not specified or invalid"); return NULL; } @@ -488,8 +488,8 @@ gchar* bd_s390_zfcp_sanitize_lun_input (const gchar *lun, GError **error) { /* first make sure we're not being played */ if ((lun == NULL) || (!*lun) || (strlen (lun) > 18)) { - g_set_error (error, BD_S390_ERROR, BD_S390_ERROR_DEVICE, - "LUN not specified or invalid"); + g_set_error_literal (error, BD_S390_ERROR, BD_S390_ERROR_DEVICE, + "LUN not specified or invalid"); return NULL; } @@ -1028,8 +1028,8 @@ gboolean bd_s390_zfcp_offline (const gchar *devno, const gchar *wwpn, const gcha } /* check if we have any matches found; if so, bail */ if (luns.gl_pathc > 0) { - g_set_error (&l_error, BD_S390_ERROR, BD_S390_ERROR_DEVICE, - "Not setting zFCP device offline since it still has other LUNs"); + g_set_error_literal (&l_error, BD_S390_ERROR, BD_S390_ERROR_DEVICE, + "Not setting zFCP device offline since it still has other LUNs"); globfree (&luns); g_free (pattern); bd_utils_report_finished (progress_id, l_error->message); diff --git a/src/plugins/smart/libatasmart.c b/src/plugins/smart/libatasmart.c index c3cc8b747..c059de9be 100644 --- a/src/plugins/smart/libatasmart.c +++ b/src/plugins/smart/libatasmart.c @@ -58,10 +58,10 @@ gboolean bd_smart_is_tech_avail (BDSmartTech tech, G_GNUC_UNUSED guint64 mode, G case BD_SMART_TECH_ATA: return TRUE; case BD_SMART_TECH_SCSI: - g_set_error (error, BD_SMART_ERROR, BD_SMART_ERROR_TECH_UNAVAIL, "SCSI SMART is unavailable with libatasmart"); + g_set_error_literal (error, BD_SMART_ERROR, BD_SMART_ERROR_TECH_UNAVAIL, "SCSI SMART is unavailable with libatasmart"); return FALSE; default: - g_set_error (error, BD_SMART_ERROR, BD_SMART_ERROR_TECH_UNAVAIL, "Unknown technology"); + g_set_error_literal (error, BD_SMART_ERROR, BD_SMART_ERROR_TECH_UNAVAIL, "Unknown technology"); return FALSE; } } @@ -479,7 +479,7 @@ BDSmartATA * bd_smart_ata_get_info_from_data (const guint8 *data, gsize data_len * Tech category: %BD_SMART_TECH_SCSI-%BD_SMART_TECH_MODE_INFO */ BDSmartSCSI * bd_smart_scsi_get_info (G_GNUC_UNUSED const gchar *device, G_GNUC_UNUSED const BDExtraArg **extra, GError **error) { - g_set_error (error, BD_SMART_ERROR, BD_SMART_ERROR_TECH_UNAVAIL, "SCSI SMART is unavailable with libatasmart"); + g_set_error_literal (error, BD_SMART_ERROR, BD_SMART_ERROR_TECH_UNAVAIL, "SCSI SMART is unavailable with libatasmart"); return FALSE; } @@ -498,7 +498,7 @@ BDSmartSCSI * bd_smart_scsi_get_info (G_GNUC_UNUSED const gchar *device, G_GNUC_ * Tech category: %BD_SMART_TECH_ATA-%BD_SMART_TECH_MODE_INFO */ gboolean bd_smart_set_enabled (G_GNUC_UNUSED const gchar *device, G_GNUC_UNUSED gboolean enabled, G_GNUC_UNUSED const BDExtraArg **extra, GError **error) { - g_set_error (error, BD_SMART_ERROR, BD_SMART_ERROR_TECH_UNAVAIL, "Enabling/disabling ATA SMART functionality is unavailable with libatasmart"); + g_set_error_literal (error, BD_SMART_ERROR, BD_SMART_ERROR_TECH_UNAVAIL, "Enabling/disabling ATA SMART functionality is unavailable with libatasmart"); return FALSE; } diff --git a/src/plugins/swap.c b/src/plugins/swap.c index 2ba3d333b..e9d927c41 100644 --- a/src/plugins/swap.c +++ b/src/plugins/swap.c @@ -184,8 +184,8 @@ gboolean bd_swap_swapon (const gchar *device, gint priority, GError **error) { /* check the device if it is an activatable swap */ probe = blkid_new_probe (); if (!probe) { - g_set_error (&l_error, BD_SWAP_ERROR, BD_SWAP_ERROR_UNKNOWN_STATE, - "Failed to create a new probe"); + g_set_error_literal (&l_error, BD_SWAP_ERROR, BD_SWAP_ERROR_UNKNOWN_STATE, + "Failed to create a new probe"); bd_utils_report_finished (progress_id, l_error->message); g_propagate_error (error, l_error); return FALSE; @@ -281,24 +281,24 @@ gboolean bd_swap_swapon (const gchar *device, gint priority, GError **error) { } if (g_strcmp0 (value, "SWAP-SPACE") == 0) { - g_set_error (&l_error, BD_SWAP_ERROR, BD_SWAP_ERROR_ACTIVATE_OLD, - "Old swap format, cannot activate."); + g_set_error_literal (&l_error, BD_SWAP_ERROR, BD_SWAP_ERROR_ACTIVATE_OLD, + "Old swap format, cannot activate."); bd_utils_report_finished (progress_id, l_error->message); g_propagate_error (error, l_error); blkid_free_probe (probe); close (fd); return FALSE; } else if (g_strcmp0 (value, "S1SUSPEND") == 0 || g_strcmp0 (value, "S2SUSPEND") == 0) { - g_set_error (&l_error, BD_SWAP_ERROR, BD_SWAP_ERROR_ACTIVATE_SUSPEND, - "Suspended system on the swap device, cannot activate."); + g_set_error_literal (&l_error, BD_SWAP_ERROR, BD_SWAP_ERROR_ACTIVATE_SUSPEND, + "Suspended system on the swap device, cannot activate."); bd_utils_report_finished (progress_id, l_error->message); g_propagate_error (error, l_error); blkid_free_probe (probe); close (fd); return FALSE; } else if (g_strcmp0 (value, "SWAPSPACE2") != 0) { - g_set_error (&l_error, BD_SWAP_ERROR, BD_SWAP_ERROR_ACTIVATE_UNKNOWN, - "Unknown swap space format, cannot activate."); + g_set_error_literal (&l_error, BD_SWAP_ERROR, BD_SWAP_ERROR_ACTIVATE_UNKNOWN, + "Unknown swap space format, cannot activate."); bd_utils_report_finished (progress_id, l_error->message); g_propagate_error (error, l_error); blkid_free_probe (probe); @@ -455,8 +455,8 @@ gboolean bd_swap_swapstatus (const gchar *device, GError **error) { */ gboolean bd_swap_check_label (const gchar *label, GError **error) { if (strlen (label) > 16) { - g_set_error (error, BD_SWAP_ERROR, BD_SWAP_ERROR_LABEL_INVALID, - "Label for swap must be at most 16 characters long."); + g_set_error_literal (error, BD_SWAP_ERROR, BD_SWAP_ERROR_LABEL_INVALID, + "Label for swap must be at most 16 characters long."); return FALSE; } @@ -498,16 +498,16 @@ gboolean bd_swap_check_uuid (const gchar *uuid, GError **error) { uuid_t uu; if (!g_str_is_ascii (uuid)) { - g_set_error (error, BD_SWAP_ERROR, BD_SWAP_ERROR_UUID_INVALID, - "Provided UUID is not a valid RFC-4122 UUID."); + g_set_error_literal (error, BD_SWAP_ERROR, BD_SWAP_ERROR_UUID_INVALID, + "Provided UUID is not a valid RFC-4122 UUID."); return FALSE; } lowercase = g_ascii_strdown (uuid, -1); ret = uuid_parse (lowercase, uu); if (ret < 0){ - g_set_error (error, BD_SWAP_ERROR, BD_SWAP_ERROR_UUID_INVALID, - "Provided UUID is not a valid RFC-4122 UUID."); + g_set_error_literal (error, BD_SWAP_ERROR, BD_SWAP_ERROR_UUID_INVALID, + "Provided UUID is not a valid RFC-4122 UUID."); return FALSE; } diff --git a/src/utils/exec.c b/src/utils/exec.c index 89fb23489..08fc73564 100644 --- a/src/utils/exec.c +++ b/src/utils/exec.c @@ -530,8 +530,8 @@ static gboolean _utils_exec_and_report_progress (const gchar **argv, const BDExt g_propagate_error (error, l_error); success = FALSE; } else if (WIFSIGNALED (status)) { - g_set_error (&l_error, BD_UTILS_EXEC_ERROR, BD_UTILS_EXEC_ERROR_FAILED, - "Process killed with a signal"); + g_set_error_literal (&l_error, BD_UTILS_EXEC_ERROR, BD_UTILS_EXEC_ERROR_FAILED, + "Process killed with a signal"); bd_utils_report_finished (progress_id, l_error->message); g_propagate_error (error, l_error); success = FALSE; @@ -539,8 +539,8 @@ static gboolean _utils_exec_and_report_progress (const gchar **argv, const BDExt } else if (child_ret == -1) { if (errno != ECHILD) { errno = 0; - g_set_error (&l_error, BD_UTILS_EXEC_ERROR, BD_UTILS_EXEC_ERROR_FAILED, - "Failed to wait for the process"); + g_set_error_literal (&l_error, BD_UTILS_EXEC_ERROR, BD_UTILS_EXEC_ERROR_FAILED, + "Failed to wait for the process"); bd_utils_report_finished (progress_id, l_error->message); g_propagate_error (error, l_error); success = FALSE; diff --git a/src/utils/module.c b/src/utils/module.c index 8f2b7727b..11e139f8a 100644 --- a/src/utils/module.c +++ b/src/utils/module.c @@ -94,8 +94,8 @@ gboolean bd_utils_have_kernel_module (const gchar *module_name, GError **error) ctx = kmod_new (NULL, (const gchar * const*) &null_config); if (!ctx) { - g_set_error (error, BD_UTILS_MODULE_ERROR, BD_UTILS_MODULE_ERROR_KMOD_INIT_FAIL, - "Failed to initialize kmod context"); + g_set_error_literal (error, BD_UTILS_MODULE_ERROR, BD_UTILS_MODULE_ERROR_KMOD_INIT_FAIL, + "Failed to initialize kmod context"); freelocale (c_locale); return FALSE; } @@ -148,8 +148,8 @@ gboolean bd_utils_load_kernel_module (const gchar *module_name, const gchar *opt ctx = kmod_new (NULL, (const gchar * const*) &null_config); if (!ctx) { - g_set_error (error, BD_UTILS_MODULE_ERROR, BD_UTILS_MODULE_ERROR_KMOD_INIT_FAIL, - "Failed to initialize kmod context"); + g_set_error_literal (error, BD_UTILS_MODULE_ERROR, BD_UTILS_MODULE_ERROR_KMOD_INIT_FAIL, + "Failed to initialize kmod context"); freelocale (c_locale); return FALSE; } @@ -217,8 +217,8 @@ gboolean bd_utils_unload_kernel_module (const gchar *module_name, GError **error ctx = kmod_new (NULL, (const gchar * const*) &null_config); if (!ctx) { - g_set_error (error, BD_UTILS_MODULE_ERROR, BD_UTILS_MODULE_ERROR_KMOD_INIT_FAIL, - "Failed to initialize kmod context"); + g_set_error_literal (error, BD_UTILS_MODULE_ERROR, BD_UTILS_MODULE_ERROR_KMOD_INIT_FAIL, + "Failed to initialize kmod context"); freelocale (c_locale); return FALSE; }