summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2005-01-03 19:57:20 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2005-01-03 19:57:20 +0000
commitf0630a910675bfbbb432e222b9de6c7a84a3458f (patch)
tree1d8ca77d34e59571074db020f7ff735d4e1c5527
parent30425906b51cb6438eea321879e53afcb722af3b (diff)
Don't return directories. (#160738, Tommi Komulainen)
2005-01-03 Matthias Clasen <mclasen@redhat.com> * glib/gutils.c (g_find_program_in_path): Don't return directories. (#160738, Tommi Komulainen)
-rw-r--r--ChangeLog3
-rw-r--r--ChangeLog.pre-2-103
-rw-r--r--ChangeLog.pre-2-123
-rw-r--r--ChangeLog.pre-2-63
-rw-r--r--ChangeLog.pre-2-83
-rw-r--r--glib/gutils.c22
6 files changed, 27 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 716f92ae1..697439ffc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2005-01-03 Matthias Clasen <mclasen@redhat.com>
+ * glib/gutils.c (g_find_program_in_path): Don't return
+ directories. (#160738, Tommi Komulainen)
+
* glib/gfileutils.c (g_file_get_contents): Clarify the
documentation. (#162251, Mariano Suárez-Alvarez)
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index 716f92ae1..697439ffc 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,5 +1,8 @@
2005-01-03 Matthias Clasen <mclasen@redhat.com>
+ * glib/gutils.c (g_find_program_in_path): Don't return
+ directories. (#160738, Tommi Komulainen)
+
* glib/gfileutils.c (g_file_get_contents): Clarify the
documentation. (#162251, Mariano Suárez-Alvarez)
diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12
index 716f92ae1..697439ffc 100644
--- a/ChangeLog.pre-2-12
+++ b/ChangeLog.pre-2-12
@@ -1,5 +1,8 @@
2005-01-03 Matthias Clasen <mclasen@redhat.com>
+ * glib/gutils.c (g_find_program_in_path): Don't return
+ directories. (#160738, Tommi Komulainen)
+
* glib/gfileutils.c (g_file_get_contents): Clarify the
documentation. (#162251, Mariano Suárez-Alvarez)
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index 716f92ae1..697439ffc 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,5 +1,8 @@
2005-01-03 Matthias Clasen <mclasen@redhat.com>
+ * glib/gutils.c (g_find_program_in_path): Don't return
+ directories. (#160738, Tommi Komulainen)
+
* glib/gfileutils.c (g_file_get_contents): Clarify the
documentation. (#162251, Mariano Suárez-Alvarez)
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index 716f92ae1..697439ffc 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,5 +1,8 @@
2005-01-03 Matthias Clasen <mclasen@redhat.com>
+ * glib/gutils.c (g_find_program_in_path): Don't return
+ directories. (#160738, Tommi Komulainen)
+
* glib/gfileutils.c (g_file_get_contents): Clarify the
documentation. (#162251, Mariano Suárez-Alvarez)
diff --git a/glib/gutils.c b/glib/gutils.c
index f717c0de6..ac6431db0 100644
--- a/glib/gutils.c
+++ b/glib/gutils.c
@@ -284,23 +284,23 @@ g_find_program_in_path (const gchar *program)
*
* Locates the first executable named @program in the user's path, in the
* same way that execvp() would locate it. Returns an allocated string
- * with the absolute path name, or NULL if the program is not found in
+ * with the absolute path name, or %NULL if the program is not found in
* the path. If @program is already an absolute path, returns a copy of
- * @program if @program exists and is executable, and NULL otherwise.
- *
+ * @program if @program exists and is executable, and %NULL otherwise.
+ *
* On Windows, if @program does not have a file type suffix, tries
* with the suffixes .exe, .cmd, .bat and .com, and the suffixes in
- * the PATHEXT environment variable.
+ * the <envar>PATHEXT</envar> environment variable.
*
* It looks for the file in the same way as CreateProcess()
* would. This means first in the directory where the executing
* program was loaded from, then in the current directory, then in the
* Windows 32-bit system directory, then in the Windows directory, and
- * finally in the directories in the PATH environment variable. If the
- * program is found, the return value contains the full name including
- * the type suffix.
+ * finally in the directories in the <envar>PATH</envar> environment
+ * variable. If the program is found, the return value contains the
+ * full name including the type suffix.
*
- * Return value: absolute path, or NULL
+ * Return value: absolute path, or %NULL
**/
#ifdef G_OS_WIN32
static gchar *
@@ -332,7 +332,8 @@ g_find_program_in_path (const gchar *program)
#endif
)
{
- if (g_file_test (program, G_FILE_TEST_IS_EXECUTABLE))
+ if (g_file_test (program, G_FILE_TEST_IS_EXECUTABLE) &&
+ !g_file_test (program, G_FILE_TEST_IS_DIR))
return g_strdup (program);
else
return NULL;
@@ -459,7 +460,8 @@ g_find_program_in_path (const gchar *program)
else
startp = memcpy (name - (p - path), path, p - path);
- if (g_file_test (startp, G_FILE_TEST_IS_EXECUTABLE))
+ if (g_file_test (startp, G_FILE_TEST_IS_EXECUTABLE) &&
+ !g_file_test (startp, G_FILE_TEST_IS_DIR))
{
gchar *ret;
ret = g_strdup (startp);