From 3bf4088b8b5a6acba59babe829d4f4bc18fc3e7a Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Mon, 18 Nov 2013 12:27:44 +0000 Subject: [PATCH] * grub-core/osdep/unix/hostdisk.c (grub_util_make_temporary_file): Handle errors from mkstemp. (grub_util_make_temporary_dir): Handle errors from mkdtemp. --- ChangeLog | 6 ++++++ grub-core/osdep/unix/hostdisk.c | 7 +++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8e286bf76..409fc70ef 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2013-11-18 Colin Watson + + * grub-core/osdep/unix/hostdisk.c (grub_util_make_temporary_file): + Handle errors from mkstemp. + (grub_util_make_temporary_dir): Handle errors from mkdtemp. + 2013-11-18 Vladimir Serbinenko Fix handling of install lists. diff --git a/grub-core/osdep/unix/hostdisk.c b/grub-core/osdep/unix/hostdisk.c index 1ca1abbfb..78d4adb71 100644 --- a/grub-core/osdep/unix/hostdisk.c +++ b/grub-core/osdep/unix/hostdisk.c @@ -281,7 +281,8 @@ grub_util_make_temporary_file (void) memcpy (tmp, t, tl); memcpy (tmp + tl, "/grub.XXXXXX", sizeof ("/grub.XXXXXX")); - mkstemp (tmp); + if (mkstemp (tmp) == -1) + grub_util_error (_("cannot make temporary file: %s"), strerror (errno)); return tmp; } @@ -298,7 +299,9 @@ grub_util_make_temporary_dir (void) memcpy (tmp, t, tl); memcpy (tmp + tl, "/grub.XXXXXX", sizeof ("/grub.XXXXXX")); - mkdtemp (tmp); + if (!mkdtemp (tmp)) + grub_util_error (_("cannot make temporary directory: %s"), + strerror (errno)); return tmp; }