* grub-core/osdep/unix/hostdisk.c (grub_util_make_temporary_file):

Handle errors from mkstemp.
(grub_util_make_temporary_dir): Handle errors from mkdtemp.
This commit is contained in:
Colin Watson 2013-11-18 12:27:44 +00:00
parent a284320e1e
commit 3bf4088b8b
2 changed files with 11 additions and 2 deletions

View file

@ -1,3 +1,9 @@
2013-11-18 Colin Watson <cjwatson@ubuntu.com>
* 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 <phcoder@gmail.com> 2013-11-18 Vladimir Serbinenko <phcoder@gmail.com>
Fix handling of install lists. Fix handling of install lists.

View file

@ -281,7 +281,8 @@ grub_util_make_temporary_file (void)
memcpy (tmp, t, tl); memcpy (tmp, t, tl);
memcpy (tmp + tl, "/grub.XXXXXX", memcpy (tmp + tl, "/grub.XXXXXX",
sizeof ("/grub.XXXXXX")); sizeof ("/grub.XXXXXX"));
mkstemp (tmp); if (mkstemp (tmp) == -1)
grub_util_error (_("cannot make temporary file: %s"), strerror (errno));
return tmp; return tmp;
} }
@ -298,7 +299,9 @@ grub_util_make_temporary_dir (void)
memcpy (tmp, t, tl); memcpy (tmp, t, tl);
memcpy (tmp + tl, "/grub.XXXXXX", memcpy (tmp + tl, "/grub.XXXXXX",
sizeof ("/grub.XXXXXX")); sizeof ("/grub.XXXXXX"));
mkdtemp (tmp); if (!mkdtemp (tmp))
grub_util_error (_("cannot make temporary directory: %s"),
strerror (errno));
return tmp; return tmp;
} }