Sisyphus repositório
Última atualização: 1 outubro 2023 | SRPMs: 18631 | Visitas: 37761272
en ru br
ALT Linux repositórios
S:7.94-alt1
5.0: 4.65-alt1.1
4.1: 4.20-alt3
4.0: 4.11-alt1.1
3.0: 3.81-alt1

Group :: Monitoramento
RPM: nmap

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs e FR  Repocop 

Patch: nmap-4.20-alt-owl-fileexistsandisreadable.patch
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;
 
projeto & código: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
mantenedor atual: Michael Shigorin
mantenedor da tradução: Fernando Martini aka fmartini © 2009