2010-01-11 Robert Millan <rmh.grub@aybabtu.com>

* util/misc.c (canonicalize_file_name): New function.
	(make_system_path_relative_to_its_root): Use canonicalize_file_name()
	instead of realpath().
This commit is contained in:
Robert Millan 2010-01-11 14:55:20 +00:00
parent a788afb626
commit 92ab12b092
2 changed files with 22 additions and 7 deletions

View file

@ -1,3 +1,9 @@
2010-01-11 Robert Millan <rmh.grub@aybabtu.com>
* util/misc.c (canonicalize_file_name): New function.
(make_system_path_relative_to_its_root): Use canonicalize_file_name()
instead of realpath().
2010-01-11 Colin Watson <cjwatson@ubuntu.com>
* util/grub-install.in (usage): Clarify meaning of --root-directory,

View file

@ -479,6 +479,19 @@ fail:
#endif /* __MINGW32__ */
char *
canonicalize_file_name (const char *path)
{
char *ret;
#ifdef PATH_MAX
ret = xmalloc (PATH_MAX);
(void) realpath (path, ret);
#else
ret = realpath (path, NULL);
#endif
return ret;
}
/* This function never prints trailing slashes (so that its output
can be appended a slash unconditionally). */
char *
@ -491,15 +504,11 @@ make_system_path_relative_to_its_root (const char *path)
size_t len;
/* canonicalize. */
p = realpath (path, NULL);
p = canonicalize_file_name (path);
if (p == NULL)
{
if (errno != EINVAL)
grub_util_error ("failed to get realpath of %s", path);
else
grub_util_error ("realpath not supporting (path, NULL)");
}
grub_util_error ("failed to get canonical path of %s", path);
len = strlen (p) + 1;
buf = strdup (p);
free (p);