mirror of
https://github.com/bol-van/zapret.git
synced 2025-08-10 01:02:03 +03:00
nfqws,tpws: r/o open instead of stat() for list file check
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include <libgen.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#ifdef __ANDROID__
|
||||
#include "andr/ifaddrs.h"
|
||||
@@ -327,6 +328,17 @@ bool file_mod_signature(const char *filename, file_mod_sig *ms)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool file_open_test(const char *filename, int flags)
|
||||
{
|
||||
int fd = open(filename,flags);
|
||||
if (fd>=0)
|
||||
{
|
||||
close(fd);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool pf_in_range(uint16_t port, const port_filter *pf)
|
||||
{
|
||||
return port && (((!pf->from && !pf->to) || (port >= pf->from && port <= pf->to)) ^ pf->neg);
|
||||
|
Reference in New Issue
Block a user