summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2016-08-06 12:57:48 +0200
committerHiltjo Posthuma <hiltjo@codemadness.org>2016-08-06 13:02:54 +0200
commite6f348c72809abb38667448dd6f7fcf12db432a3 (patch)
treeb47213bf4bacc7d46aa6dabed54bfa309e1b9aae
parentb0dd38e9570cdf9125786639e9568ad4b5e8befa (diff)
add USE_PLEDGE, remove pledge dummy function
-rw-r--r--sfeed.c2
-rw-r--r--sfeed_frames.c2
-rw-r--r--sfeed_html.c2
-rw-r--r--sfeed_mbox.c2
-rw-r--r--sfeed_opml_import.c2
-rw-r--r--sfeed_plain.c2
-rw-r--r--sfeed_tail.c2
-rw-r--r--sfeed_web.c2
-rw-r--r--sfeed_xmlenc.c2
-rw-r--r--util.c8
-rw-r--r--util.h9
11 files changed, 21 insertions, 14 deletions
diff --git a/sfeed.c b/sfeed.c
index 2bba7e8..99ee875 100644
--- a/sfeed.c
+++ b/sfeed.c
@@ -778,8 +778,10 @@ xml_handler_end_el(XMLParser *p, const char *name, size_t namelen, int isshort)
int
main(int argc, char *argv[])
{
+#ifdef USE_PLEDGE
if (pledge("stdio", NULL) == -1)
err(1, "pledge");
+#endif
if (argc > 1)
baseurl = argv[1];
diff --git a/sfeed_frames.c b/sfeed_frames.c
index 288e5e3..240a4cb 100644
--- a/sfeed_frames.c
+++ b/sfeed_frames.c
@@ -249,8 +249,10 @@ main(int argc, char *argv[])
int i, showsidebar = (argc > 1);
struct feed *f;
+#ifdef USE_PLEDGE
if (pledge("stdio rpath wpath cpath fattr", NULL) == -1)
err(1, "pledge");
+#endif
if (!(feeds = calloc(argc, sizeof(struct feed *))))
err(1, "calloc");
diff --git a/sfeed_html.c b/sfeed_html.c
index 1a8b5cc..6f6811c 100644
--- a/sfeed_html.c
+++ b/sfeed_html.c
@@ -85,8 +85,10 @@ main(int argc, char *argv[])
FILE *fp;
int i;
+#ifdef USE_PLEDGE
if (pledge(argc == 1 ? "stdio" : "stdio rpath", NULL) == -1)
err(1, "pledge");
+#endif
if (!(feeds = calloc(argc, sizeof(struct feed *))))
err(1, "calloc");
diff --git a/sfeed_mbox.c b/sfeed_mbox.c
index 413318f..3649422 100644
--- a/sfeed_mbox.c
+++ b/sfeed_mbox.c
@@ -123,8 +123,10 @@ main(int argc, char *argv[])
char *name;
int i;
+#ifdef USE_PLEDGE
if (pledge(argc == 1 ? "stdio" : "stdio rpath", NULL) == -1)
err(1, "pledge");
+#endif
if (!(user = getenv("USER")))
user = "you";
diff --git a/sfeed_opml_import.c b/sfeed_opml_import.c
index fdee71a..c69986f 100644
--- a/sfeed_opml_import.c
+++ b/sfeed_opml_import.c
@@ -76,8 +76,10 @@ xml_handler_attrentity(XMLParser *p, const char *tag, size_t taglen,
int
main(void)
{
+#ifdef USE_PLEDGE
if (pledge("stdio", NULL) == -1)
err(1, "pledge");
+#endif
parser.xmlattr = xml_handler_attr;
parser.xmlattrentity = xml_handler_attrentity;
diff --git a/sfeed_plain.c b/sfeed_plain.c
index ee836b5..79f6429 100644
--- a/sfeed_plain.c
+++ b/sfeed_plain.c
@@ -53,8 +53,10 @@ main(int argc, char *argv[])
char *name;
int i;
+#ifdef USE_PLEDGE
if (pledge(argc == 1 ? "stdio" : "stdio rpath", NULL) == -1)
err(1, "pledge");
+#endif
if ((comparetime = time(NULL)) == -1)
err(1, "time");
diff --git a/sfeed_tail.c b/sfeed_tail.c
index fbbcba0..5571c0b 100644
--- a/sfeed_tail.c
+++ b/sfeed_tail.c
@@ -91,8 +91,10 @@ main(int argc, char *argv[])
FILE *fp;
int i;
+#ifdef USE_PLEDGE
if (pledge(argc == 1 ? "stdio" : "stdio rpath", NULL) == -1)
err(1, "pledge");
+#endif
if (!(bucket = buckets = calloc(argc, sizeof(struct bucket))))
err(1, "calloc");
diff --git a/sfeed_web.c b/sfeed_web.c
index 525bd84..58cc58c 100644
--- a/sfeed_web.c
+++ b/sfeed_web.c
@@ -78,8 +78,10 @@ xmlattr(XMLParser *p, const char *tag, size_t taglen, const char *name,
int
main(int argc, char *argv[])
{
+#ifdef USE_PLEDGE
if (pledge("stdio", NULL) == -1)
err(1, "pledge");
+#endif
if (argc > 1)
strlcpy(basehref, argv[1], sizeof(basehref));
diff --git a/sfeed_xmlenc.c b/sfeed_xmlenc.c
index 4a5f12c..a20a692 100644
--- a/sfeed_xmlenc.c
+++ b/sfeed_xmlenc.c
@@ -46,8 +46,10 @@ xmlattr(XMLParser *p, const char *tag, size_t taglen, const char *name,
int
main(void)
{
+#ifdef USE_PLEDGE
if (pledge("stdio", NULL) == -1)
err(1, "pledge");
+#endif
parser.xmlattr = xmlattr;
parser.xmltagend = xmltagend;
diff --git a/util.c b/util.c
index c867a09..93f349e 100644
--- a/util.c
+++ b/util.c
@@ -14,14 +14,6 @@
#include "util.h"
-#ifndef USE_PLEDGE
-int
-pledge(const char *promises, const char *paths[])
-{
- return 0;
-}
-#endif
-
int
parseuri(const char *s, struct uri *u, int rel)
{
diff --git a/util.h b/util.h
index 089c001..b731ce6 100644
--- a/util.h
+++ b/util.h
@@ -1,5 +1,8 @@
#include <stdint.h>
#include <time.h>
+#ifdef USE_PLEDGE
+#include <unistd.h>
+#endif
#undef strlcat
size_t strlcat(char *, const char *, size_t);
@@ -37,11 +40,5 @@ void printutf8pad(FILE *, const char *, size_t, int);
int strtotime(const char *, time_t *);
void xmlencode(const char *, FILE *);
-#ifdef USE_PLEDGE
-#include <unistd.h>
-#else
-int pledge(const char *, const char *[]);
-#endif
-
#define ROT32(x, y) ((x << y) | (x >> (32 - y)))
uint32_t murmur3_32(const char *, uint32_t, uint32_t);