diff options
author | 2018-03-17 09:41:40 -0400 | |
---|---|---|
committer | 2018-03-17 09:44:07 -0400 | |
commit | 336f4df44f2d71f7da37ebafeabb2077d23d4e27 (patch) | |
tree | 81bce3ffbb456fac8fe5420d5cdca759373dae8c /src/firejail/profile.c | |
parent | apparmor deployment (diff) | |
download | firejail-336f4df44f2d71f7da37ebafeabb2077d23d4e27.tar.gz firejail-336f4df44f2d71f7da37ebafeabb2077d23d4e27.tar.zst firejail-336f4df44f2d71f7da37ebafeabb2077d23d4e27.zip |
split run files processing in a separate file - src/firejail/run_files.c
Diffstat (limited to 'src/firejail/profile.c')
-rw-r--r-- | src/firejail/profile.c | 23 |
1 files changed, 2 insertions, 21 deletions
diff --git a/src/firejail/profile.c b/src/firejail/profile.c index 77308b7ac..5566b9860 100644 --- a/src/firejail/profile.c +++ b/src/firejail/profile.c | |||
@@ -1241,27 +1241,8 @@ void profile_read(const char *fname) { | |||
1241 | } | 1241 | } |
1242 | 1242 | ||
1243 | // save the name of the file for --profile.print option | 1243 | // save the name of the file for --profile.print option |
1244 | if (include_level == 0) { | 1244 | if (include_level == 0) |
1245 | char *runfile; | 1245 | set_profile_run_file(getpid(), fname); |
1246 | if (asprintf(&runfile, "%s/%d", RUN_FIREJAIL_PROFILE_DIR, getpid()) == -1) | ||
1247 | errExit("asprintf"); | ||
1248 | |||
1249 | EUID_ROOT(); | ||
1250 | // the file is deleted first | ||
1251 | FILE *fp = fopen(runfile, "w"); | ||
1252 | if (!fp) { | ||
1253 | fprintf(stderr, "Error: cannot create %s\n", runfile); | ||
1254 | exit(1); | ||
1255 | } | ||
1256 | fprintf(fp, "%s\n", fname); | ||
1257 | |||
1258 | // mode and ownership | ||
1259 | SET_PERMS_STREAM(fp, 0, 0, 0644); | ||
1260 | fclose(fp); | ||
1261 | EUID_USER(); | ||
1262 | free(runfile); | ||
1263 | } | ||
1264 | |||
1265 | 1246 | ||
1266 | int msg_printed = 0; | 1247 | int msg_printed = 0; |
1267 | 1248 | ||