mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-29 10:39:22 +00:00
* util/grub-menulst2cfg.c (main): Check return value of fwrite.
* util/grub-mklayout.c (write_file): Likewise. New argument fname. All users updated.
This commit is contained in:
1 parent
9133fd053f
commit
8aeb18379b
3 files changed
+31
-9
No files matched your search
+10
-1
@@ -35,6 +35,7 @@ main (int argc, char **argv)
|
||||
size_t bufsize = 0;
|
||||
char *suffix = xstrdup ("");
|
||||
int suffixlen = 0;
|
||||
const char *out_fname = 0;
|
||||
|
||||
if (argc >= 2 && argv[1][0] == '-')
|
||||
{
|
||||
@@ -66,6 +67,7 @@ main (int argc, char **argv)
|
||||
argv[2], strerror (errno));
|
||||
return 1;
|
||||
}
|
||||
out_fname = argv[2];
|
||||
}
|
||||
else
|
||||
out = stdout;
|
||||
@@ -109,7 +111,14 @@ main (int argc, char **argv)
|
||||
if (entryname)
|
||||
fprintf (out, "}\n\n");
|
||||
|
||||
fwrite (suffix, 1, suffixlen, out);
|
||||
if (fwrite (suffix, 1, suffixlen, out) != suffixlen)
|
||||
{
|
||||
if (out_fname)
|
||||
grub_util_error ("cannot write to `%s': %s",
|
||||
out_fname, strerror (errno));
|
||||
else
|
||||
grub_util_error ("cannot write to the stdout: %s", strerror (errno));
|
||||
}
|
||||
|
||||
free (buf);
|
||||
free (suffix);
|
||||
|
||||
Reference in new issue
Block a user