From: Colin Walters Date: Sat, 18 Feb 2017 15:15:39 +0000 (-0500) Subject: lib: Ensure an error is set in ensure_unlinked() if errno != ENOENT X-Git-Tag: archive/raspbian/2022.1-3+rpi1~1^2~4^2~40^2~29 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=c9356a50b860aacace0ca819d0849854de9edd4d;p=ostree.git 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 --- 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; }