From e5eb6f3a220cddc01fd4d8a6db66935bddd3b3b2 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Sun, 29 May 2016 13:33:25 -0400 Subject: [PATCH] libglnx porting: Port callers of gs_file_unlink to just unlink() In the second case it's actually less code too. Closes: #312 Approved by: giuseppe --- src/libostree/ostree-repo.c | 7 +++++-- src/libotutil/ot-gio-utils.c | 21 ++++----------------- 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c index f2538f51..1d0b2f93 100644 --- a/src/libostree/ostree-repo.c +++ b/src/libostree/ostree-repo.c @@ -1255,8 +1255,11 @@ impl_repo_remote_delete (OstreeRepo *self, if (remote->file != NULL) { - if (!gs_file_unlink (remote->file, cancellable, error)) - goto out; + if (unlink (gs_file_get_path_cached (remote->file)) != 0) + { + glnx_set_error_from_errno (error); + goto out; + } } else { diff --git a/src/libotutil/ot-gio-utils.c b/src/libotutil/ot-gio-utils.c index 103f6edd..6541a321 100644 --- a/src/libotutil/ot-gio-utils.c +++ b/src/libotutil/ot-gio-utils.c @@ -390,25 +390,12 @@ ot_gfile_ensure_unlinked (GFile *path, GCancellable *cancellable, GError **error) { - gboolean ret = FALSE; - GError *temp_error = NULL; - - if (!gs_file_unlink (path, cancellable, &temp_error)) + if (unlink (gs_file_get_path_cached (path)) != 0) { - if (g_error_matches (temp_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND)) - { - g_clear_error (&temp_error); - } - else - { - g_propagate_error (error, temp_error); - goto out; - } + if (errno != ENOENT) + return FALSE; } - - ret = TRUE; - out: - return ret; + return TRUE; } /**