Skip to content

Commit

Permalink
private-lib cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
netblue30 committed Mar 9, 2023
1 parent b689b69 commit 91f2b3f
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 23 deletions.
1 change: 0 additions & 1 deletion src/firejail/firejail.h
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,6 @@ void fs_var_run(void);
void fs_var_lock(void);
void fs_var_tmp(void);
void fs_var_utmp(void);
void dbg_test_dir(const char *dir);

// fs_dev.c
void fs_dev_shm(void);
Expand Down
1 change: 0 additions & 1 deletion src/firejail/fs_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ static void mount_dev_shm(void) {
int rv = mount(RUN_DEV_DIR "/shm", "/dev/shm", "none", MS_BIND, "mode=01777,gid=0");
if (rv == -1) {
fwarning("cannot mount the old /dev/shm in private-dev\n");
dbg_test_dir(RUN_DEV_DIR "/shm");
empty_dev_shm();
return;
}
Expand Down
23 changes: 2 additions & 21 deletions src/firejail/fs_var.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,21 +230,6 @@ void fs_var_cache(void) {
}
}

void dbg_test_dir(const char *dir) {
if (arg_debug) {
if (is_dir(dir))
printf("%s is a directory\n", dir);
if (is_link(dir)) {
char *lnk = realpath(dir, NULL);
if (lnk) {
printf("%s is a symbolic link to %s\n", dir, lnk);
free(lnk);
}
}
}
}


void fs_var_lock(void) {

if (is_dir("/var/lock")) {
Expand All @@ -254,10 +239,8 @@ void fs_var_lock(void) {
errExit("mounting /lock");
fs_logger("tmpfs /var/lock");
}
else {
else
fwarning("/var/lock not mounted\n");
dbg_test_dir("/var/lock");
}
}

void fs_var_tmp(void) {
Expand All @@ -271,10 +254,8 @@ void fs_var_tmp(void) {
fs_logger("tmpfs /var/tmp");
}
}
else {
else
fwarning("/var/tmp not mounted\n");
dbg_test_dir("/var/tmp");
}
}

void fs_var_utmp(void) {
Expand Down
7 changes: 7 additions & 0 deletions src/fldd/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include "../include/common.h"
#include "../include/ldd_utils.h"
#ifdef HAVE_PRIVATE_LIB

#include <fcntl.h>
#include <sys/mman.h>
Expand Down Expand Up @@ -357,3 +358,9 @@ printf("\n");
close(fd);
return 0;
}
#else
int main(void) {
printf("Sorry, private lib is disabled in this build\n");
return 0;
}
#endif
2 changes: 2 additions & 0 deletions src/lib/ldd_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <sys/stat.h>
#include <fcntl.h>

#ifdef HAVE_PRIVATE_LIB
// todo: resolve overlap with masked_lib_dirs[] array from fs_lib.c
const char * const default_lib_paths[] = {
"/usr/lib/x86_64-linux-gnu", // Debian & friends
Expand Down Expand Up @@ -63,3 +64,4 @@ int is_lib_64(const char *exe) {
close(fd);
return retval;
}
#endif

0 comments on commit 91f2b3f

Please sign in to comment.