mirror of
https://github.com/nmap/nmap.git
synced 2026-08-03 22:29:06 +00:00
portability fix from diman
This commit is contained in:
parent
d4d8bcf9f6
commit
e3a4b7294c
1 changed files with 7 additions and 1 deletions
8
nmap.cc
8
nmap.cc
|
|
@ -2276,6 +2276,12 @@ 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
|
||||
* zero if it is not
|
||||
|
|
@ -2286,7 +2292,7 @@ static int fileexistsandisreadable(char *pathname) {
|
|||
if (stat(pathname, &st) == -1)
|
||||
return 0;
|
||||
|
||||
if (!S_ISDIR(st.st_mode) && (access(pathname, R_OK) != -1))
|
||||
if (!S_ISDIR(st.st_mode) && STAT_READABLE(st))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue