From: Philippe E. <ph...@us...> - 2005-04-27 08:17:55
|
Update of /cvsroot/oprofile/oprofile/libutil In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6023/libutil Modified Files: Tag: BRANCH_ANON_MAPPING op_file.c op_file.h Log Message: op_file_readable() return sucess only for regular file Index: op_file.c =================================================================== RCS file: /cvsroot/oprofile/oprofile/libutil/op_file.c,v retrieving revision 1.22 retrieving revision 1.22.4.1 diff -u -p -d -r1.22 -r1.22.4.1 --- op_file.c 22 Apr 2005 19:29:21 -0000 1.22 +++ op_file.c 27 Apr 2005 08:17:40 -0000 1.22.4.1 @@ -23,7 +23,8 @@ int op_file_readable(char const * file) { - return !access(file, R_OK); + struct stat st; + return !stat(file, &st) && S_ISREG(st.st_mode) && !access(file, R_OK); } Index: op_file.h =================================================================== RCS file: /cvsroot/oprofile/oprofile/libutil/op_file.h,v retrieving revision 1.13 retrieving revision 1.13.4.1 diff -u -p -d -r1.13 -r1.13.4.1 --- op_file.h 22 Apr 2005 19:29:21 -0000 1.13 +++ op_file.h 27 Apr 2005 08:17:40 -0000 1.13.4.1 @@ -22,7 +22,7 @@ extern "C" { * op_file_readable - is a file readable * @param file file name * - * Return true if the given file is readable. + * Return true if the given file is readable and regular. * * Beware of race conditions ! */ |