> -----Original Message----- > From: Grub-devel <grub-devel-bounces+elliott=hpe....@gnu.org> On > Behalf Of Colin Watson > Sent: Wednesday, February 27, 2019 3:10 AM > Subject: [PATCH] util: Detect more I/O errors > ... > -void > +int > grub_util_file_sync (FILE *f) > { > - fflush (f); > + if (fflush (f) != 0) > + return -1; > if (!allow_fd_syncs) > - return; > - fsync (fileno (f)); > + return 0; > + return fsync (fileno (f)); > } Since that's just returning -1 for an error (both for fflush and fsync), not errno which contains the reason for the error... > diff --git a/util/editenv.c b/util/editenv.c > index c6f8d2298..eb2d0c03a 100644 > --- a/util/editenv.c > +++ b/util/editenv.c > @@ -55,7 +55,8 @@ grub_util_create_envblk_file (const char *name) > strerror (errno)); > > > - grub_util_file_sync (fp); > + if (grub_util_file_sync (fp) < 0) > + grub_util_error (_("cannot sync `%s': %s"), namenew, strerror > (errno)); callers like this will interpret the -1 as EPERM, which isn't the true reason. --- Robert Elliott, HPE Persistent Memory _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel
RE: [PATCH] util: Detect more I/O errors
Elliott, Robert (Persistent Memory) Thu, 28 Feb 2019 08:33:50 -0800
- [PATCH] util: Detect more I/O errors Colin Watson
- Re: [PATCH] util: Detect more I/O... Steve McIntyre
- Re: [PATCH] util: Detect more I/O... Colin Watson
- RE: [PATCH] util: Detect more I/O... Elliott, Robert (Persistent Memory)
- Re: [PATCH] util: Detect more... Colin Watson
- Re: [PATCH] util: Detect more I/O... Daniel Kiper