+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,
#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 *
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);