diff options
author | Colin Walters <walters@verbum.org> | 2017-07-17 18:05:25 -0400 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2017-07-18 19:07:56 +0000 |
commit | 9430b8ad75b5a17cdd05ca3e4eeab1a6302c6f63 (patch) | |
tree | f5e8b2ae8118a5f6a9f55236c5f1068d6041a4e8 /src/ostree/ot-remote-builtin-list-cookies.c | |
parent | e0346c149498a7ec7d5c064a9d5485c9dcb693b1 (diff) | |
download | ostree-9430b8ad75b5a17cdd05ca3e4eeab1a6302c6f63.tar.gz |
bin/cookies: Drop libsoup code, fix fd-relative issues, new style
Prep for `ostree_repo_new_at()`. These commands were directly accessing
`repo->repodir`, which it turns out was unnecessary since the the APIs they then
used were fd-relative. Except actually there were bugs there, so fix all of the
cookie util code to actually use the passed `dfd` and not just hardcode
`AT_FDCWD`.
Also, libsoup can't handle this (its APIs require fully qualifed paths), and
there's not a really good reason to have two implementations now; historically
it was useful to cross-check them, but I don't think we need that.
While I'm here, port to new style.
Closes: #1010
Approved by: jlebon
Diffstat (limited to 'src/ostree/ot-remote-builtin-list-cookies.c')
-rw-r--r-- | src/ostree/ot-remote-builtin-list-cookies.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/ostree/ot-remote-builtin-list-cookies.c b/src/ostree/ot-remote-builtin-list-cookies.c index 83d75a57..18c69035 100644 --- a/src/ostree/ot-remote-builtin-list-cookies.c +++ b/src/ostree/ot-remote-builtin-list-cookies.c @@ -35,13 +35,8 @@ static GOptionEntry option_entries[] = { gboolean ot_remote_builtin_list_cookies (int argc, char **argv, GCancellable *cancellable, GError **error) { - g_autoptr(GOptionContext) context = NULL; g_autoptr(OstreeRepo) repo = NULL; - const char *remote_name; - g_autofree char *jar_path = NULL; - g_autofree char *cookie_file = NULL; - - context = g_option_context_new ("NAME - Show remote repository cookies"); + g_autoptr(GOptionContext) context = g_option_context_new ("NAME - Show remote repository cookies"); if (!ostree_option_context_parse (context, option_entries, &argc, &argv, OSTREE_BUILTIN_FLAG_NONE, &repo, cancellable, error)) @@ -53,12 +48,9 @@ ot_remote_builtin_list_cookies (int argc, char **argv, GCancellable *cancellable return FALSE; } - remote_name = argv[1]; - - cookie_file = g_strdup_printf ("%s.cookies.txt", remote_name); - jar_path = g_build_filename (g_file_get_path (repo->repodir), cookie_file, NULL); - - if (!ot_list_cookies_at (AT_FDCWD, jar_path, error)) + const char *remote_name = argv[1]; + g_autofree char *cookie_file = g_strdup_printf ("%s.cookies.txt", remote_name); + if (!ot_list_cookies_at (ostree_repo_get_dfd (repo), cookie_file, error)) return FALSE; return TRUE; |