Skip to contentSkip to conversation

Use _fullpath instead of realpath on mingw32

PATCH Applied Mario Limonciello 2 participants 2 messages Sep 21, 2011 – Sep 29, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 2/3 Use _fullpath instead of realpath on mingw32

=== modified file 'ChangeLog'

ChangeLog 2011-09-21 20:38:06 +0000 renamed from ChangeLog 2011-09-21 20:36:50 +0000 +1 -0
@@ -1,6 +1,7 @@
 2011-09-21  Mario Limonciello <[email protected]>
 
        * Remove extra declaration of sleep for mingw32.
+       * No realpath on mingw32.  Instead use _fullpath.
 
 2011-09-17  Grégoire Sutre <[email protected]>
 

=== modified file 'grub-core/kern/emu/misc.c'

kern/emu/misc.c 2011-09-21 20:38:06 +0000 renamed from kern/emu/misc.c 2011-07-08 11:33:12 +0000 +6 -0
@@ -224,6 +224,11 @@
 canonicalize_file_name (const char *path)
 {
   char *ret;
+#ifdef __MINGW32__
+  ret = xmalloc(PATH_MAX);
+  if (!_fullpath(ret, path, PATH_MAX))
+    return NULL;
+#else
 #ifdef PATH_MAX
   ret = xmalloc (PATH_MAX);
   if (!realpath (path, ret))
@@ -231,6 +236,7 @@
 #else
   ret = realpath (path, NULL);
 #endif
+#endif /* __MINGW32__ */
   return ret;
 }
 

=== modified file 'ChangeLog'

ChangeLog +1 -0
@@ -1,6 +1,7 @@
 2011-09-21  Mario Limonciello <[email protected]>
 
 	* Remove extra declaration of sleep for mingw32.
+	* No realpath on mingw32.  Instead use _fullpath.
 
 2011-09-17  Grégoire Sutre  <[email protected]>
 

=== modified file 'grub-core/kern/emu/misc.c'

kern/emu/misc.c +6 -0
@@ -224,6 +224,11 @@
 canonicalize_file_name (const char *path)
 {
   char *ret;
+#ifdef __MINGW32__
+  ret = xmalloc(PATH_MAX);
+  if (!_fullpath(ret, path, PATH_MAX))
+    return NULL;
+#else
 #ifdef PATH_MAX
   ret = xmalloc (PATH_MAX);
   if (!realpath (path, ret))
@@ -231,6 +236,7 @@
 #else
   ret = realpath (path, NULL);
 #endif
+#endif /* __MINGW32__ */
   return ret;
 }
 
#1 lore raw

Applied. Several stylistic problem (the uselessly nested #if being one of them) fixed.

Quoted 42 lines · Mario Limonciello

=== modified file 'ChangeLog'

ChangeLog 2011-09-21 20:38:06 +0000 renamed from ChangeLog 2011-09-21 20:36:50 +0000 +1 -0
@@ -1,6 +1,7 @@
 2011-09-21  Mario Limonciello <[email protected]>
 
        * Remove extra declaration of sleep for mingw32.
+       * No realpath on mingw32.  Instead use _fullpath.
 
 2011-09-17  Grégoire Sutre <[email protected]>
 

=== modified file 'grub-core/kern/emu/misc.c'

kern/emu/misc.c 2011-09-21 20:38:06 +0000 renamed from kern/emu/misc.c 2011-07-08 11:33:12 +0000 +6 -0
@@ -224,6 +224,11 @@
 canonicalize_file_name (const char *path)
 {
   char *ret;
+#ifdef __MINGW32__
+  ret = xmalloc(PATH_MAX);
+  if (!_fullpath(ret, path, PATH_MAX))
+    return NULL;
+#else
 #ifdef PATH_MAX
   ret = xmalloc (PATH_MAX);
   if (!realpath (path, ret))
@@ -231,6 +236,7 @@
 #else
   ret = realpath (path, NULL);
 #endif
+#endif /* __MINGW32__ */
   return ret;
 }
 

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 2 lines
Regards
Vladimir 'φ-coder/phcoder' Serbinenko