mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-22 08:58:54 +02:00
Test for the existence of getcwd, and use it only when found.
2000-09-19 Sebastian Wilhelmi <wilhelmi@ira.uka.de> * acconfig.h, configure.in, gutils.c: Test for the existence of getcwd, and use it only when found. * glib.h: Only use the gcc-variable-macro-argument-extension for gcc >= 2.4. Both patches from Jonas Oberg <jonas@gnu.org>.
This commit is contained in:
committed by
Sebastian Wilhelmi
parent
ddbb2ea440
commit
e2600b0476
@@ -430,11 +430,11 @@ g_get_current_dir (void)
|
||||
/* We don't use getcwd(3) on SUNOS, because, it does a popen("pwd")
|
||||
* and, if that wasn't bad enough, hangs in doing so.
|
||||
*/
|
||||
#if defined (sun) && !defined (__SVR4)
|
||||
#if (defined (sun) && !defined (__SVR4)) || !defined(HAVE_GETCWD)
|
||||
buffer = g_new (gchar, max_len + 1);
|
||||
*buffer = 0;
|
||||
dir = getwd (buffer);
|
||||
#else /* !sun */
|
||||
#else /* !sun || !HAVE_GETCWD */
|
||||
while (max_len < G_MAXULONG / 2)
|
||||
{
|
||||
buffer = g_new (gchar, max_len + 1);
|
||||
@@ -447,7 +447,7 @@ g_get_current_dir (void)
|
||||
g_free (buffer);
|
||||
max_len *= 2;
|
||||
}
|
||||
#endif /* !sun */
|
||||
#endif /* !sun || !HAVE_GETCWD */
|
||||
|
||||
if (!dir || !*buffer)
|
||||
{
|
||||
|
Reference in New Issue
Block a user