Group :: Monitoramento
RPM: nmap
Main Changelog Spec Patches Sources Download Gear Bugs e FR Repocop
Patch: nmap-4.20-alt-owl-fileexistsandisreadable.patch
Download
Download
diff -urp nmap-4.20.orig/nmap.cc nmap-4.20/nmap.cc
--- nmap-4.20.orig/nmap.cc 2006-10-14 06:03:54 +0000
+++ nmap-4.20/nmap.cc 2007-10-07 09:25:46 +0000
@@ -2262,23 +2262,16 @@ void sigdie(int signo) {
exit(1);
}
-#ifdef WIN32
-#define STAT_READABLE(st) st.st_mode & S_IREAD
-#else
-#define STAT_READABLE(st) st.st_mode & S_IRUSR
-#endif
-
-/* Returns true (nonzero) if the file pathname given exists, is not
- * a directory and is readable by the executing process. Returns
+/* Returns true (nonzero) if the file pathname given exists, is a
+ * regular file, and is readable by the executing process. Returns
* zero if it is not
*/
static int fileexistsandisreadable(char *pathname) {
struct stat st;
- if (stat(pathname, &st) == -1)
- return 0;
-
- if (!S_ISDIR(st.st_mode) && STAT_READABLE(st))
+ if (access(pathname, R_OK) == 0 &&
+ stat(pathname, &st) == 0 &&
+ S_ISREG(st.st_mode))
return 1;
return 0;