From b69fd11487cfa23ff930da6b80b73e03b0daabe3 Mon Sep 17 00:00:00 2001 From: Jonathan Lebon Date: Mon, 11 Apr 2016 09:27:35 -0400 Subject: [PATCH] ostree-repo-pull: always initialize flags_i Otherwise we get undefined behaviour if the client didn't explicitly set any flags. Also, add documentation for all the other options supported by ostree_repo_pull_with_options(). Closes: #252 Approved by: cgwalters --- src/libostree/ostree-repo-pull.c | 2 +- src/libostree/ostree-repo.c | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/libostree/ostree-repo-pull.c b/src/libostree/ostree-repo-pull.c index 8eca91c3..e86ede50 100644 --- a/src/libostree/ostree-repo-pull.c +++ b/src/libostree/ostree-repo-pull.c @@ -1908,7 +1908,7 @@ ostree_repo_pull_with_options (OstreeRepo *self, if (options) { - int flags_i; + int flags_i = OSTREE_REPO_PULL_FLAGS_NONE; (void) g_variant_lookup (options, "refs", "^a&s", &refs_to_fetch); (void) g_variant_lookup (options, "flags", "i", &flags_i); /* Reduce risk of issues if enum happens to be 64 bit for some reason */ diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c index 47519e66..d59c8e78 100644 --- a/src/libostree/ostree-repo.c +++ b/src/libostree/ostree-repo.c @@ -3999,11 +3999,17 @@ ostree_repo_pull_one_dir (OstreeRepo *self, * Like ostree_repo_pull(), but supports an extensible set of flags. * The following are currently defined: * - * * subdir (s): Pull just this subdirectory + * * refs (as): Array of string refs * * flags (i): An instance of #OstreeRepoPullFlags - * * refs: (as): Array of string refs - * * depth: (i): How far in the history to traverse; default is 0, -1 means infinite - * * override-commit-ids: (as): Array of specific commit IDs to fetch for refs + * * subdir (s): Pull just this subdirectory + * * override-remote-name (s): If local, add this remote to refspec + * * gpg-verify (b): GPG verify commits + * * gpg-verify-summary (b): GPG verify summary + * * depth (i): How far in the history to traverse; default is 0, -1 means infinite + * * disable-static-deltas (b): Do not use static deltas + * * require-static-deltas (b): Require static deltas + * * override-commit-ids (as): Array of specific commit IDs to fetch for refs + * * dry-run (b): Only print information on what will be downloaded (requires static deltas) */ gboolean ostree_repo_pull_with_options (OstreeRepo *self,