make g_file_test(,G_FILE_TEST_IS_EXECUTABLE) return something useful on

2003-12-14  Hans Breuer  <hans@breuer.org>

	* glib/gfileutils.c : make g_file_test(,G_FILE_TEST_IS_EXECUTABLE)
	return something useful on win32, too.
This commit is contained in:
Hans Breuer 2003-12-14 19:05:29 +00:00 committed by Hans Breuer
parent 35a6cff869
commit aaa2ab083e
7 changed files with 36 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2003-12-14 Hans Breuer <hans@breuer.org>
* glib/gfileutils.c : make g_file_test(,G_FILE_TEST_IS_EXECUTABLE)
return something useful on win32, too.
2003-12-13 Hans Breuer <hans@breuer.org>
* glib/gconvert.c : get_filename_charset() needs to

View File

@ -1,3 +1,8 @@
2003-12-14 Hans Breuer <hans@breuer.org>
* glib/gfileutils.c : make g_file_test(,G_FILE_TEST_IS_EXECUTABLE)
return something useful on win32, too.
2003-12-13 Hans Breuer <hans@breuer.org>
* glib/gconvert.c : get_filename_charset() needs to

View File

@ -1,3 +1,8 @@
2003-12-14 Hans Breuer <hans@breuer.org>
* glib/gfileutils.c : make g_file_test(,G_FILE_TEST_IS_EXECUTABLE)
return something useful on win32, too.
2003-12-13 Hans Breuer <hans@breuer.org>
* glib/gconvert.c : get_filename_charset() needs to

View File

@ -1,3 +1,8 @@
2003-12-14 Hans Breuer <hans@breuer.org>
* glib/gfileutils.c : make g_file_test(,G_FILE_TEST_IS_EXECUTABLE)
return something useful on win32, too.
2003-12-13 Hans Breuer <hans@breuer.org>
* glib/gconvert.c : get_filename_charset() needs to

View File

@ -1,3 +1,8 @@
2003-12-14 Hans Breuer <hans@breuer.org>
* glib/gfileutils.c : make g_file_test(,G_FILE_TEST_IS_EXECUTABLE)
return something useful on win32, too.
2003-12-13 Hans Breuer <hans@breuer.org>
* glib/gconvert.c : get_filename_charset() needs to

View File

@ -1,3 +1,8 @@
2003-12-14 Hans Breuer <hans@breuer.org>
* glib/gfileutils.c : make g_file_test(,G_FILE_TEST_IS_EXECUTABLE)
return something useful on win32, too.
2003-12-13 Hans Breuer <hans@breuer.org>
* glib/gconvert.c : get_filename_charset() needs to

View File

@ -40,7 +40,6 @@
#include <io.h>
#ifndef F_OK
#define F_OK 0
#define X_OK 1
#define W_OK 2
#define R_OK 4
#endif /* !F_OK */
@ -121,11 +120,10 @@ g_file_test (const gchar *filename,
if ((test & G_FILE_TEST_EXISTS) && (access (filename, F_OK) == 0))
return TRUE;
#ifndef G_OS_WIN32
if ((test & G_FILE_TEST_IS_EXECUTABLE) && (access (filename, X_OK) == 0))
{
#ifndef G_OS_WIN32
if (getuid () != 0)
#endif
return TRUE;
/* For root, on some POSIX systems, access (filename, X_OK)
@ -135,6 +133,7 @@ g_file_test (const gchar *filename,
}
else
test &= ~G_FILE_TEST_IS_EXECUTABLE;
#endif
if (test & G_FILE_TEST_IS_SYMLINK)
{
@ -171,6 +170,10 @@ g_file_test (const gchar *filename,
(s.st_mode & S_IXUSR) ||
(s.st_mode & S_IXGRP)))
return TRUE;
#else
if ((test & G_FILE_TEST_IS_EXECUTABLE) &&
(s.st_mode & _S_IEXEC))
return TRUE;
#endif
}
}