aboutsummaryrefslogtreecommitdiffstats
path: root/src/fnettrace/runprog.c
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@protonmail.com>2023-07-24 17:55:16 -0400
committerLibravatar netblue30 <netblue30@protonmail.com>2023-07-24 17:55:16 -0400
commitc4b6af8f1c48e9727eea6d91f9aae3476bae762e (patch)
tree0f18aa6851df5a6761b6991e284584642e657cae /src/fnettrace/runprog.c
parentfnettrace: trace ICPM ECHO (ping) traffic (diff)
downloadfirejail-c4b6af8f1c48e9727eea6d91f9aae3476bae762e.tar.gz
firejail-c4b6af8f1c48e9727eea6d91f9aae3476bae762e.tar.zst
firejail-c4b6af8f1c48e9727eea6d91f9aae3476bae762e.zip
integrating nettrace dnstrace and snitrace
Diffstat (limited to 'src/fnettrace/runprog.c')
-rw-r--r--src/fnettrace/runprog.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/fnettrace/runprog.c b/src/fnettrace/runprog.c
new file mode 100644
index 000000000..e30d8a16c
--- /dev/null
+++ b/src/fnettrace/runprog.c
@@ -0,0 +1,31 @@
1/*
2 * Copyright (C) 2014-2023 Firejail Authors
3 *
4 * This file is part of firejail project
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19*/
20#include "fnettrace.h"
21
22int runprog(const char *program) {
23 assert(program);
24 FILE *fp = popen(program, "r");
25 if (!fp) {
26 fprintf(stderr, "Error: cannot run %s\n", program);
27 return -1;
28 }
29
30 return fileno(fp);
31}