Skip to content

Commit

Permalink
refactor: make rundir lock variables global
Browse files Browse the repository at this point in the history
To enable using them outside of src/firejail/main.c.
  • Loading branch information
kmk3 authored and spiiroin committed Apr 23, 2024
1 parent 3736925 commit 773073c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/firejail/firejail.h
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,8 @@ static inline int any_dhcp(void) {
return any_ip_dhcp() || any_ip6_dhcp();
}

extern int lockfd_directory;
extern int lockfd_network;
extern int arg_private; // mount private /home
extern int arg_private_cache; // private home/.cache
extern int arg_debug; // print debug messages
Expand Down
4 changes: 2 additions & 2 deletions src/firejail/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ gid_t firejail_gid = 0;
static char child_stack[STACK_SIZE] __attribute__((aligned(STACK_ALIGNMENT))); // space for child's stack

Config cfg; // configuration
int lockfd_directory = -1;
int lockfd_network = -1;
int arg_private = 0; // mount private /home and /tmp directoryu
int arg_private_cache = 0; // mount private home/.cache
int arg_debug = 0; // print debug messages
Expand Down Expand Up @@ -1056,8 +1058,6 @@ static int check_postexec(const char *list) {
int main(int argc, char **argv, char **envp) {
int i;
int prog_index = -1; // index in argv where the program command starts
int lockfd_network = -1;
int lockfd_directory = -1;
int custom_profile = 0; // custom profile loaded
int arg_caps_cmdline = 0; // caps requested on command line (used to break out of --chroot)
char **ptr;
Expand Down

0 comments on commit 773073c

Please sign in to comment.