diff options
author | Jasper Lievisse Adriaanse <j@jasper.la> | 2017-12-22 10:40:40 +0100 |
---|---|---|
committer | Hans Petter Jansson <hpj@cl.no> | 2019-07-23 18:49:05 +0200 |
commit | 7cebcedd9cf392977d40910a660245dc3f73b257 (patch) | |
tree | 6dc1167359ffdaee7618420fe945e091f8ac02d7 | |
parent | 217cb97b7a9b093835282f736be34f0d4b01be09 (diff) | |
download | desktop-file-utils-7cebcedd9cf392977d40910a660245dc3f73b257.tar.gz |
Use pledge(2) on OpenBSD to limit the sets of syscalls that can be used
Signed-off-by: Hans Petter Jansson <hpj@cl.no>
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | src/update-desktop-database.c | 7 |
2 files changed, 9 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index f342196..633d9e3 100644 --- a/configure.ac +++ b/configure.ac @@ -10,6 +10,8 @@ AM_CONFIG_HEADER(config.h) AC_PROG_LN_S AC_PROG_CC +AC_CHECK_FUNCS(pledge) + if test "x$GCC" = "xyes"; then changequote(,)dnl case " $CFLAGS " in diff --git a/src/update-desktop-database.c b/src/update-desktop-database.c index 7f48357..ce4d8c8 100644 --- a/src/update-desktop-database.c +++ b/src/update-desktop-database.c @@ -450,6 +450,13 @@ main (int argc, { NULL } }; +#if HAVE_PLEDGE + if (pledge("stdio rpath wpath cpath fattr", NULL) == -1) { + g_printerr ("pledge\n"); + return 1; + } +#endif + context = g_option_context_new (""); g_option_context_set_summary (context, _("Build cache database of MIME types handled by desktop files.")); g_option_context_add_main_entries (context, options, NULL); |