From c9356a50b860aacace0ca819d0849854de9edd4d Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Sat, 18 Feb 2017 10:15:39 -0500 Subject: [PATCH] lib: Ensure an error is set in ensure_unlinked() if errno != ENOENT We hit this with: ``` 27411 unlink("/boot/efi/EFI/fedora/grub.cfg.new") = -1 EROFS (Read-only file system) ``` from the grub2 code. https://github.com/projectatomic/rpm-ostree/issues/633 Closes: #694 Approved by: giuseppe --- src/libotutil/ot-gio-utils.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libotutil/ot-gio-utils.c b/src/libotutil/ot-gio-utils.c index ba21b467..da32653e 100644 --- a/src/libotutil/ot-gio-utils.c +++ b/src/libotutil/ot-gio-utils.c @@ -309,7 +309,10 @@ ot_gfile_ensure_unlinked (GFile *path, if (unlink (gs_file_get_path_cached (path)) != 0) { if (errno != ENOENT) - return FALSE; + { + glnx_set_error_from_errno (error); + return FALSE; + } } return TRUE; }