diff --git a/src/fu-tool.c b/src/fu-tool.c index 314884867..4d803a408 100644 --- a/src/fu-tool.c +++ b/src/fu-tool.c @@ -485,13 +485,20 @@ fu_util_get_updates (FuUtilPrivate *priv, gchar **values, GError **error) g_node_append_data (child, g_object_ref (rel)); } } - if (g_node_n_nodes (root, G_TRAVERSE_ALL) > 1) - fu_util_print_tree (root, title); /* save the device state for other applications to see */ if (!fu_util_save_current_state (priv, error)) return FALSE; - /* success */ + /* updates */ + if (g_node_n_nodes (root, G_TRAVERSE_ALL) <= 1) { + g_set_error_literal (error, + FWUPD_ERROR, + FWUPD_ERROR_NOTHING_TO_DO, + "No updates available for remaining devices"); + return FALSE; + } + + fu_util_print_tree (root, title); return TRUE; } diff --git a/src/fu-util.c b/src/fu-util.c index 9b30dec34..340663c66 100644 --- a/src/fu-util.c +++ b/src/fu-util.c @@ -1442,9 +1442,6 @@ fu_util_get_updates (FuUtilPrivate *priv, gchar **values, GError **error) } } - if (g_node_n_nodes (root, G_TRAVERSE_ALL) > 1) - fu_util_print_tree (root, title); - /* nag? */ if (!fu_util_perhaps_show_unreported (priv, error)) return FALSE; @@ -1452,11 +1449,21 @@ fu_util_get_updates (FuUtilPrivate *priv, gchar **values, GError **error) /* no devices supported by LVFS or all are filtered */ if (!supported) { g_set_error_literal (error, - FWUPD_ERROR, - FWUPD_ERROR_NOTHING_TO_DO, - "No updatable devices"); + FWUPD_ERROR, + FWUPD_ERROR_NOTHING_TO_DO, + "No updatable devices"); return FALSE; } + /* no updates available */ + if (g_node_n_nodes (root, G_TRAVERSE_ALL) <= 1) { + g_set_error_literal (error, + FWUPD_ERROR, + FWUPD_ERROR_NOTHING_TO_DO, + "No updates available for remaining devices"); + return FALSE; + } + + fu_util_print_tree (root, title); /* success */ return TRUE;