Group :: Monitoramento
RPM: nmap
Main Changelog Spec Patches Sources Download Gear Bugs e FR Repocop
Patch: nmap-5.51-alt-owl-fileexistsandisreadable.patch
Download
Download
--- nmap/nbase/nbase_misc.c
+++ nmap/nbase/nbase_misc.c
@@ -734,10 +734,13 @@ int fileexistsandisreadable(const char *pathname) {
#endif
- if (stat(pathname_buf, &st) == -1)
- status = 0;
- else if (access(pathname_buf, R_OK) != -1)
- status = S_ISDIR(st.st_mode) ? 2 : 1;
+ if (access(pathname_buf, R_OK) == 0 && stat(pathname_buf, &st) == 0) {
+ if (S_ISREG(st.st_mode)) {
+ status = 1;
+ } else if (S_ISDIR(st.st_mode)) {
+ status = 2;
+ }
+ }
free(pathname_buf);
return status;