From 250e305f738dc8ce6d80b54bbb8b649b1a09a118 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 28 Jun 2017 21:50:10 -0400 Subject: [PATCH] lib/repo: Port bareuser-conversion stat to bare load I noticed this is a simple call that's useful to port to the new internal-only non-allocating API. Closes: #977 Approved by: jlebon --- src/libostree/ostree-repo.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c index 20f866b9..a53a056e 100644 --- a/src/libostree/ostree-repo.c +++ b/src/libostree/ostree-repo.c @@ -3074,25 +3074,24 @@ import_one_object_link (OstreeRepo *self, */ if (import_is_bareuser_only_conversion (source, self, objtype)) { - g_autoptr(GFileInfo) finfo = NULL; + struct stat stbuf; - if (!ostree_repo_load_file (source, checksum, NULL, &finfo, NULL, - cancellable, error)) + if (!_ostree_repo_load_file_bare (source, checksum, NULL, &stbuf, + NULL, NULL, cancellable, error)) return FALSE; - switch (g_file_info_get_file_type (finfo)) + if (S_ISREG (stbuf.st_mode)) { - case G_FILE_TYPE_REGULAR: /* This is OK, we'll drop through and try a hardlink */ - break; - case G_FILE_TYPE_SYMBOLIC_LINK: + } + else if (S_ISLNK (stbuf.st_mode)) + { /* NOTE early return */ *out_was_supported = FALSE; return TRUE; - default: - g_assert_not_reached (); - break; } + else + g_assert_not_reached (); } if (!_ostree_repo_ensure_loose_objdir_at (self->objects_dir_fd, loose_path_buf, cancellable, error))