diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/firejail/main.c | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/src/firejail/main.c b/src/firejail/main.c index c7470c33b..f1095d41f 100644 --- a/src/firejail/main.c +++ b/src/firejail/main.c | |||
@@ -1504,7 +1504,11 @@ int main(int argc, char **argv) { | |||
1504 | fprintf(stderr, "Error: invalid private-home option\n"); | 1504 | fprintf(stderr, "Error: invalid private-home option\n"); |
1505 | exit(1); | 1505 | exit(1); |
1506 | } | 1506 | } |
1507 | cfg.home_private_keep = argv[i] + 15; | 1507 | if (cfg.home_private_keep) { |
1508 | if ( asprintf(&cfg.home_private_keep, "%s,%s", cfg.home_private_keep, argv[i] + 15) < 0 ) | ||
1509 | errExit("asprintf"); | ||
1510 | } else | ||
1511 | cfg.home_private_keep = argv[i] + 15; | ||
1508 | arg_private = 1; | 1512 | arg_private = 1; |
1509 | } | 1513 | } |
1510 | else | 1514 | else |
@@ -1525,7 +1529,11 @@ int main(int argc, char **argv) { | |||
1525 | fprintf(stderr, "Error: invalid private-etc option\n"); | 1529 | fprintf(stderr, "Error: invalid private-etc option\n"); |
1526 | exit(1); | 1530 | exit(1); |
1527 | } | 1531 | } |
1528 | cfg.etc_private_keep = argv[i] + 14; | 1532 | if (cfg.etc_private_keep) { |
1533 | if ( asprintf(&cfg.etc_private_keep, "%s,%s", cfg.etc_private_keep, argv[i] + 14) < 0 ) | ||
1534 | errExit("asprintf"); | ||
1535 | } else | ||
1536 | cfg.etc_private_keep = argv[i] + 14; | ||
1529 | arg_private_etc = 1; | 1537 | arg_private_etc = 1; |
1530 | } | 1538 | } |
1531 | else if (strncmp(argv[i], "--private-opt=", 14) == 0) { | 1539 | else if (strncmp(argv[i], "--private-opt=", 14) == 0) { |
@@ -1534,7 +1542,11 @@ int main(int argc, char **argv) { | |||
1534 | fprintf(stderr, "Error: invalid private-opt option\n"); | 1542 | fprintf(stderr, "Error: invalid private-opt option\n"); |
1535 | exit(1); | 1543 | exit(1); |
1536 | } | 1544 | } |
1537 | cfg.opt_private_keep = argv[i] + 14; | 1545 | if (cfg.opt_private_keep) { |
1546 | if ( asprintf(&cfg.opt_private_keep, "%s,%s", cfg.opt_private_keep, argv[i] + 14) < 0 ) | ||
1547 | errExit("asprintf"); | ||
1548 | } else | ||
1549 | cfg.opt_private_keep = argv[i] + 14; | ||
1538 | arg_private_opt = 1; | 1550 | arg_private_opt = 1; |
1539 | } | 1551 | } |
1540 | else if (strncmp(argv[i], "--private-srv=", 14) == 0) { | 1552 | else if (strncmp(argv[i], "--private-srv=", 14) == 0) { |
@@ -1543,7 +1555,11 @@ int main(int argc, char **argv) { | |||
1543 | fprintf(stderr, "Error: invalid private-etc option\n"); | 1555 | fprintf(stderr, "Error: invalid private-etc option\n"); |
1544 | exit(1); | 1556 | exit(1); |
1545 | } | 1557 | } |
1546 | cfg.srv_private_keep = argv[i] + 14; | 1558 | if (cfg.srv_private_keep) { |
1559 | if ( asprintf(&cfg.srv_private_keep, "%s,%s", cfg.srv_private_keep, argv[i] + 14) < 0 ) | ||
1560 | errExit("asprintf"); | ||
1561 | } else | ||
1562 | cfg.srv_private_keep = argv[i] + 14; | ||
1547 | arg_private_srv = 1; | 1563 | arg_private_srv = 1; |
1548 | } | 1564 | } |
1549 | else if (strncmp(argv[i], "--private-bin=", 14) == 0) { | 1565 | else if (strncmp(argv[i], "--private-bin=", 14) == 0) { |
@@ -1552,7 +1568,11 @@ int main(int argc, char **argv) { | |||
1552 | fprintf(stderr, "Error: invalid private-bin option\n"); | 1568 | fprintf(stderr, "Error: invalid private-bin option\n"); |
1553 | exit(1); | 1569 | exit(1); |
1554 | } | 1570 | } |
1555 | cfg.bin_private_keep = argv[i] + 14; | 1571 | if (cfg.bin_private_keep) { |
1572 | if ( asprintf(&cfg.bin_private_keep, "%s,%s", cfg.bin_private_keep, argv[i] + 14) < 0 ) | ||
1573 | errExit("asprintf"); | ||
1574 | } else | ||
1575 | cfg.bin_private_keep = argv[i] + 14; | ||
1556 | arg_private_bin = 1; | 1576 | arg_private_bin = 1; |
1557 | } | 1577 | } |
1558 | else if (strcmp(argv[i], "--private-tmp") == 0) { | 1578 | else if (strcmp(argv[i], "--private-tmp") == 0) { |