summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2016-12-08 21:35:21 +0100
committerAleksander Morgado <aleksander@aleksander.es>2017-01-16 11:24:15 +0100
commit69400a6bd5c55c4cc4fe6db0067032244d2bc76f (patch)
tree9f30f552c01bf4bff09eff95f92df709bd7d00b4
parentfe5163c5c04f5606cb14433fe53dfff11ad73d1c (diff)
downloadlibqmi-69400a6bd5c55c4cc4fe6db0067032244d2bc76f.tar.gz
qmi-firmware-update: use PERMISSION_DENIED to flag errors that may be forced
-rw-r--r--src/qmi-firmware-update/qfu-operation-update.c4
-rw-r--r--src/qmi-firmware-update/qfu-updater.c12
2 files changed, 7 insertions, 9 deletions
diff --git a/src/qmi-firmware-update/qfu-operation-update.c b/src/qmi-firmware-update/qfu-operation-update.c
index beee292f..64862d55 100644
--- a/src/qmi-firmware-update/qfu-operation-update.c
+++ b/src/qmi-firmware-update/qfu-operation-update.c
@@ -63,10 +63,8 @@ run_ready (QfuUpdater *updater,
if (!qfu_updater_run_finish (updater, res, &error)) {
g_printerr ("error: %s\n", error->message);
- if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_INVALID_DATA) ||
- g_error_matches (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT)) {
+ if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED))
g_printerr ("note: you can ignore this error using --force\n");
- }
g_error_free (error);
} else {
g_print ("firmware update operation finished successfully\n");
diff --git a/src/qmi-firmware-update/qfu-updater.c b/src/qmi-firmware-update/qfu-updater.c
index 571c71d1..ab7f4343 100644
--- a/src/qmi-firmware-update/qfu-updater.c
+++ b/src/qmi-firmware-update/qfu-updater.c
@@ -758,7 +758,7 @@ validate_firmware_config_carrier (QfuUpdater *self,
ctx->firmware_version = g_strdup (firmware_version);
else if (!g_str_equal (firmware_version, ctx->firmware_version)) {
if (!self->priv->force) {
- g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_DATA,
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED,
"couldn't detect firmware version: "
"firmware version strings don't match on specified images: "
"'%s' != '%s'",
@@ -776,7 +776,7 @@ validate_firmware_config_carrier (QfuUpdater *self,
ctx->config_version = g_strdup (config_version);
else if (!g_str_equal (config_version, ctx->config_version)) {
if (!self->priv->force) {
- g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_DATA,
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED,
"couldn't detect config version: "
"config version strings don't match on specified images: "
"'%s' != '%s'",
@@ -794,7 +794,7 @@ validate_firmware_config_carrier (QfuUpdater *self,
ctx->carrier = g_strdup (carrier);
else if (!g_str_equal (carrier, ctx->carrier)) {
if (!self->priv->force) {
- g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_DATA,
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED,
"couldn't detect carrier: "
"carrier strings don't match on specified images: "
"'%s' != '%s'",
@@ -811,7 +811,7 @@ validate_firmware_config_carrier (QfuUpdater *self,
/* If given firmware version doesn't match the one in the image, error out */
if (self->priv->firmware_version && (g_strcmp0 (self->priv->firmware_version, ctx->firmware_version) != 0)) {
if (!self->priv->force) {
- g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED,
"error validating firmware version: "
"user provided firmware version doesn't match the one in the specified images: "
"'%s' != '%s'",
@@ -826,7 +826,7 @@ validate_firmware_config_carrier (QfuUpdater *self,
/* If given config version doesn't match the one in the image, error out */
if (self->priv->config_version && (g_strcmp0 (self->priv->config_version, ctx->config_version) != 0)) {
if (!self->priv->force) {
- g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED,
"error validating firmware version: "
"user provided firmware version doesn't match the one in the specified images: "
"'%s' != '%s'",
@@ -841,7 +841,7 @@ validate_firmware_config_carrier (QfuUpdater *self,
/* If given carrier doesn't match the one in the image, error out */
if (self->priv->carrier && (g_strcmp0 (self->priv->carrier, ctx->carrier) != 0)) {
if (!self->priv->force) {
- g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED,
"error validating carrier: "
"user provided carrier doesn't match the one in the specified images: "
"'%s' != '%s'",