Re: Utility functions from gnome-libs



On Mon, Jul 03, 2000 at 12:18:39PM -0400, Owen Taylor wrote:
> enum {
> 	G_FILE_TEST_ISFILE=1<<0,
> 	G_FILE_TEST_ISLINK=1<<1,
> 	G_FILE_TEST_ISDIR=1<<2,
> 	G_FILE_TEST_EXISTS=(1<<0)|(1<<1)|(1<<2) /*any type of file*/
> };
> 
> gboolean g_file_test   (const char *filename, int test);
> gboolean g_file_exists (const char *filename);
> 
> (These might alternatively be called g_file_race() ;-), but 
> they are useful for a lot of things, and a note in the
> docs about security implications should be OK.)

	Why not do them more securely?  A common task is a
test-and-open, and that contains races.  How about a
g_file_test_and_open() that takes the enum args and returns the fd or an
error value?  The function can do whatever fully secure, NFS-happy
implementation it wants.

Joel

-- 

"The opposite of a correct statement is a false statement. The
 opposite of a profound truth may well be another profound truth."
         - Niels Bohr 

			http://zenii.uk.linux.org/~jlbec/
			jlbec@evilplan.org




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]