mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-21 06:45:29 -06:00
refactor: deduplicate definition of RUN_FIREJAIL_NAME_DIR
Reuse the definition from src/include/rundefs.h. Related commits: *07c05e8a5("moved sandbox name to /run/firejail/name/<PID>", 2016-02-19) *57ffc35a8("added sandbox name support in firemon", 2018-03-21)
This commit is contained in:
parent
187488a2dc
commit
4a31419eab
3 changed files with 5 additions and 8 deletions
|
|
@ -25,7 +25,7 @@
|
|||
#define RUN_FIREJAIL_DIR RUN_FIREJAIL_BASEDIR "/firejail"
|
||||
#define RUN_FIREJAIL_SANDBOX_DIR RUN_FIREJAIL_DIR "/sandbox"
|
||||
#define RUN_FIREJAIL_APPIMAGE_DIR RUN_FIREJAIL_DIR "/appimage"
|
||||
#define RUN_FIREJAIL_NAME_DIR RUN_FIREJAIL_DIR "/name" // also used in src/lib/pid.c - todo: move it in a common place
|
||||
#define RUN_FIREJAIL_NAME_DIR RUN_FIREJAIL_DIR "/name"
|
||||
#define RUN_FIREJAIL_LIB_DIR RUN_FIREJAIL_DIR "/lib"
|
||||
#define RUN_FIREJAIL_X11_DIR RUN_FIREJAIL_DIR "/x11"
|
||||
#define RUN_FIREJAIL_NETWORK_DIR RUN_FIREJAIL_DIR "/network"
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
#include <limits.h>
|
||||
#include <sched.h>
|
||||
#include "../include/common.h"
|
||||
#include "../include/rundefs.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
#ifndef O_PATH
|
||||
|
|
@ -155,10 +156,9 @@ int name2pid(const char *name, pid_t *pid) {
|
|||
free(comm);
|
||||
}
|
||||
|
||||
// look for the sandbox name in /run/firejail/name/<PID>
|
||||
// todo: use RUN_FIREJAIL_NAME_DIR define from src/firejail/firejail.h
|
||||
// look for the sandbox name
|
||||
char *fname;
|
||||
if (asprintf(&fname, "/run/firejail/name/%d", newpid) == -1)
|
||||
if (asprintf(&fname, "%s/%d", RUN_FIREJAIL_NAME_DIR, newpid) == -1)
|
||||
errExit("asprintf");
|
||||
FILE *fp = fopen(fname, "r");
|
||||
if (fp) {
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include "../include/common.h"
|
||||
#include "../include/pid.h"
|
||||
#include "../include/rundefs.h"
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
|
@ -173,10 +174,6 @@ doexit:
|
|||
return rv;
|
||||
}
|
||||
|
||||
// todo: RUN_FIREJAIL_NAME_DIR is borrowed from src/firejail/firejail.h
|
||||
// move it in a common place
|
||||
#define RUN_FIREJAIL_NAME_DIR "/run/firejail/name"
|
||||
|
||||
static void print_elem(unsigned index, int nowrap) {
|
||||
// get terminal size
|
||||
struct winsize sz;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue