pledge textproc/grepcidr, suggested by/ok job@
This commit is contained in:
parent
875ff3a029
commit
6cd3699a49
@ -3,7 +3,7 @@ COMMENT= filter files for IP address matches
|
||||
# note there's also a "grepcidr-2" fork; this port is for the original
|
||||
# version which is still developed by the original author.
|
||||
DISTNAME= grepcidr-2.0
|
||||
REVISION= 0
|
||||
REVISION= 1
|
||||
|
||||
CATEGORIES= textproc net
|
||||
|
||||
|
33
textproc/grepcidr/patches/patch-grepcidr_c
Normal file
33
textproc/grepcidr/patches/patch-grepcidr_c
Normal file
@ -0,0 +1,33 @@
|
||||
Index: grepcidr.c
|
||||
--- grepcidr.c.orig
|
||||
+++ grepcidr.c
|
||||
@@ -580,6 +580,12 @@ int main(int argc, char* argv[])
|
||||
char* pat_strings = NULL; /* pattern strings on command line */
|
||||
int foundopt;
|
||||
|
||||
+ if (pledge("stdio rpath", NULL) == -1)
|
||||
+ {
|
||||
+ fprintf(stderr, "grepcidr: pledge()");
|
||||
+ return EXIT_ERROR;
|
||||
+ }
|
||||
+
|
||||
if ((CHAR_BIT != 8) || (sizeof(unsigned int) < 4) ||
|
||||
(sizeof(struct in_addr) != 4) || (sizeof(struct in6_addr) != 16))
|
||||
{
|
||||
@@ -660,8 +666,15 @@ int main(int argc, char* argv[])
|
||||
{ /* Search each specified file name, or just stdin */
|
||||
const char* curfilename = NULL;
|
||||
FILE* inp_stream;
|
||||
- if (optind >= argc)
|
||||
+ if (optind >= argc) {
|
||||
inp_stream = stdin;
|
||||
+
|
||||
+ if (pledge("stdio", NULL) == -1)
|
||||
+ {
|
||||
+ fprintf(stderr, "grepcidr: pledge()");
|
||||
+ return EXIT_ERROR;
|
||||
+ }
|
||||
+ }
|
||||
else
|
||||
{
|
||||
/* One or more file names are specified on the command line */
|
Loading…
Reference in New Issue
Block a user