From efd460782a439394cf980b82db7a93a81b887a4b Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Mon, 17 Jul 2017 20:50:55 -0400 Subject: [PATCH] lib/pull: Drop direct use of ->repodir Prep for `ostree_repo_new_at()`. Down the line perhaps we should extend libcurl to accept a file descriptor for cookies, but this works OK for now. Closes: #1010 Approved by: jlebon --- src/libostree/ostree-repo-pull.c | 16 ++++++++-------- src/ostree/ot-remote-cookie-util.c | 14 +++++++------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/libostree/ostree-repo-pull.c b/src/libostree/ostree-repo-pull.c index 97e410e7..60d11414 100644 --- a/src/libostree/ostree-repo-pull.c +++ b/src/libostree/ostree-repo-pull.c @@ -2697,16 +2697,16 @@ _ostree_repo_remote_new_fetcher (OstreeRepo *self, } { - g_autofree char *jar_path = NULL; - g_autofree char *cookie_file = g_strdup_printf ("%s.cookies.txt", - remote_name); + g_autofree char *cookie_file = g_strdup_printf ("%s.cookies.txt", remote_name); + /* TODO; port away from this; a bit hard since both libsoup and libcurl + * expect a file. Doing ot_fdrel_to_gfile() works for now though. + */ + GFile*repo_path = ostree_repo_get_path (self); + g_autofree char *jar_path = + g_build_filename (gs_file_get_path_cached (repo_path), cookie_file, NULL); - jar_path = g_build_filename (gs_file_get_path_cached (self->repodir), cookie_file, - NULL); - - if (g_file_test(jar_path, G_FILE_TEST_IS_REGULAR)) + if (g_file_test (jar_path, G_FILE_TEST_IS_REGULAR)) _ostree_fetcher_set_cookie_jar (fetcher, jar_path); - } success = TRUE; diff --git a/src/ostree/ot-remote-cookie-util.c b/src/ostree/ot-remote-cookie-util.c index a20a3465..914af5af 100644 --- a/src/ostree/ot-remote-cookie-util.c +++ b/src/ostree/ot-remote-cookie-util.c @@ -153,13 +153,13 @@ ot_add_cookie_at (int dfd, const char *jar_path, /* Adapted from soup-cookie-jar-text.c:write_cookie() */ g_autofree char *buf = g_strdup_printf ("%s\t%s\t%s\t%s\t%llu\t%s\t%s\n", - domain, - *domain == '.' ? "TRUE" : "FALSE", - path, - "FALSE", - (long long unsigned)g_date_time_to_unix (expires), - name, - value); + domain, + *domain == '.' ? "TRUE" : "FALSE", + path, + "FALSE", + (long long unsigned)g_date_time_to_unix (expires), + name, + value); if (glnx_loop_write (fd, buf, strlen (buf)) < 0) return glnx_throw_errno_prefix (error, "write"); return TRUE;