diff dmd/inifile.c @ 35:3cfcb944304e trunk

[svn r39] * Updated to DMD 1.022 with the exception of: Bugzilla 278: dmd.conf search path doesn't work This fix was causing crashes for me :/ So for it's the old behaviour
author lindquist
date Tue, 09 Oct 2007 06:21:30 +0200
parents c53b6e3fe49a
children 297690b5d4a5
line wrap: on
line diff
--- a/dmd/inifile.c	Tue Oct 09 02:50:00 2007 +0200
+++ b/dmd/inifile.c	Tue Oct 09 06:21:30 2007 +0200
@@ -76,6 +76,28 @@
 		if (!FileName::exists(filename))
 		{
 #if linux
+
+#if 0
+#if __GLIBC__	    // This fix by Thomas Kuehne
+		    /* argv0 might be a symbolic link,
+		     * so try again looking past it to the real path
+		     */
+		    char* real_argv0 = realpath(argv0, NULL);
+		    if (real_argv0)
+		    {
+			filename = FileName::replaceName(real_argv0, inifile);
+			free(real_argv0);
+			if (FileName::exists(filename))
+			    goto Ldone;
+		    }
+#else
+#error use of glibc non-standard extension realpath(char*, NULL)
+#endif
+#endif
+
+	// old way; problem is that argv0 might not be on the PATH at all
+	// and some other instance might be found
+
 		    // Search PATH for argv0
 		    const char *p = getenv("PATH");
 		    Array *paths = FileName::splitPath(p);