aboutsummaryrefslogtreecommitdiffstats
path: root/src/firejail/util.c
diff options
context:
space:
mode:
authorLibravatar ಚಿರಾಗ್ ನಟರಾಜ್ <chiraag.nataraj@gmail.com>2018-07-31 14:37:22 -0400
committerLibravatar ಚಿರಾಗ್ ನಟರಾಜ್ <chiraag.nataraj@gmail.com>2018-07-31 14:37:22 -0400
commitff9a5d6a9a97da326cac60cc73883e95e3d51ce2 (patch)
tree71db5b87bb65e55c46382f9935a087216c71f101 /src/firejail/util.c
parentCheck to see if expand_home is called as root and switch to user (and restore... (diff)
downloadfirejail-ff9a5d6a9a97da326cac60cc73883e95e3d51ce2.tar.gz
firejail-ff9a5d6a9a97da326cac60cc73883e95e3d51ce2.tar.zst
firejail-ff9a5d6a9a97da326cac60cc73883e95e3d51ce2.zip
Fixed Documents handling (consume trailing /) and hide XDG warnings unless --debug is enabled.
Diffstat (limited to 'src/firejail/util.c')
-rw-r--r--src/firejail/util.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/firejail/util.c b/src/firejail/util.c
index d501a469d..2aa4c26a7 100644
--- a/src/firejail/util.c
+++ b/src/firejail/util.c
@@ -132,7 +132,7 @@ char *resolve_xdg(int flags, const char *var, size_t length, const char *prnt) {
132 return NULL; 132 return NULL;
133 133
134 errout: 134 errout:
135 if (!arg_private) { 135 if (!arg_private && arg_debug) {
136 fprintf(stderr, "***\n"); 136 fprintf(stderr, "***\n");
137 fprintf(stderr, "*** Error: %s directory was not found in user home.\n",prnt); 137 fprintf(stderr, "*** Error: %s directory was not found in user home.\n",prnt);
138 fprintf(stderr, "*** \tAny files saved by the program, will be lost when the sandbox is closed.\n"); 138 fprintf(stderr, "*** \tAny files saved by the program, will be lost when the sandbox is closed.\n");
@@ -863,7 +863,7 @@ void notify_other(int fd) {
863char *expand_home(const char *path, const char* homedir) { 863char *expand_home(const char *path, const char* homedir) {
864 assert(path); 864 assert(path);
865 assert(homedir); 865 assert(homedir);
866 866
867 int called_as_root = 0; 867 int called_as_root = 0;
868 868
869 if(geteuid() == 0) 869 if(geteuid() == 0)
@@ -995,7 +995,7 @@ char *expand_home(const char *path, const char* homedir) {
995 } 995 }
996 996
997 else if (strncmp(path, "${DOCUMENTS}", 12) == 0) { 997 else if (strncmp(path, "${DOCUMENTS}", 12) == 0) {
998 char *tmp = resolve_xdg(arg_debug, "XDG_DOCUMENTS_DIR=\"$HOME/", 24, "Documents"); 998 char *tmp = resolve_xdg(arg_debug, "XDG_DOCUMENTS_DIR=\"$HOME/", 25, "Documents");
999 char *tmp2 = resolve_hardcoded(arg_debug, doentry, "Documents"); 999 char *tmp2 = resolve_hardcoded(arg_debug, doentry, "Documents");
1000 if(tmp) { 1000 if(tmp) {
1001 if (asprintf(&new_name, "%s/%s%s", homedir, tmp, path + 12) == -1) 1001 if (asprintf(&new_name, "%s/%s%s", homedir, tmp, path + 12) == -1)