From: Colin Walters Date: Thu, 29 Jun 2017 01:50:10 +0000 (-0400) Subject: lib/repo: Port bareuser-conversion stat to bare load X-Git-Tag: archive/raspbian/2022.1-3+rpi1~1^2~4^2~35^2~20 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=250e305f738dc8ce6d80b54bbb8b649b1a09a118;p=ostree.git 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 --- 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))