dir: Don't overzealously rewrite an error

It's an error to call g_set_error() on an error that's already set, and
flatpak_dir_get_deploy_data() already sets FLATPAK_ERROR_NOT_INSTALLED
for us when necessary, so just pass on any errors to the caller of
flatpak_dir_get_origin(). In the case that the error is something else,
that should be treated as an error, because we never expect the deploy
directory to exist but not have a deploy file (see the implementations
of flatpak_dir_deploy() and flatpak_dir_undeploy()).

Closes: #3032
Approved by: alexlarsson

(cherry picked from commit b44c1a5799)
(cherry picked from commit 8ed03ef61e)

Closes: #3115
Approved by: alexlarsson
This commit is contained in:
Matthew Leeds
2019-07-25 09:15:50 -07:00
committed by Atomic Bot
parent e4a7b2e2fd
commit 11070054b4

View File

@@ -2422,11 +2422,7 @@ flatpak_dir_get_origin (FlatpakDir *self,
deploy_data = flatpak_dir_get_deploy_data (self, ref, FLATPAK_DEPLOY_VERSION_ANY,
cancellable, error);
if (deploy_data == NULL)
{
g_set_error (error, FLATPAK_ERROR, FLATPAK_ERROR_NOT_INSTALLED,
_("%s not installed"), ref);
return NULL;
}
return NULL;
return g_strdup (flatpak_deploy_data_get_origin (deploy_data));
}