]> git.ipfire.org Git - people/ric9/pakfire.git/commitdiff
jail: Rename pakfire_jail_exec to pakfire_jail_exec_command
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 29 Dec 2024 15:45:31 +0000 (15:45 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 29 Dec 2024 15:48:51 +0000 (15:48 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/build.c
src/libpakfire/include/pakfire/jail.h
src/libpakfire/jail.c
tests/libpakfire/cgroup.c
tests/libpakfire/jail.c

index ad49d66c71664af9160eefc161f148232b0a3027..ef0edcea7fac9f19ecc122003587ac240e1e34f5 100644 (file)
@@ -2552,7 +2552,7 @@ PAKFIRE_EXPORT int pakfire_build_shell(struct pakfire_build* build, const char*
 
        // Run the command (if given)
        if (argv)
-               return pakfire_jail_exec(build->jail, argv, build->env, 0);
+               return pakfire_jail_exec_command(build->jail, argv, build->env, 0);
 
        // Otherwise run the shell
        return pakfire_jail_shell(build->jail);
index b6ac0015e0448c53018965101c715411dae90b79..3abbf20e2b7bbe1bf7a0c137f5a9bc6033409635 100644 (file)
@@ -66,7 +66,7 @@ enum pakfire_jail_exec_flags {
        PAKFIRE_JAIL_HAS_LOOP_DEVICES = (1 << 3),
 };
 
-int pakfire_jail_exec(struct pakfire_jail* jail,
+int pakfire_jail_exec_command(struct pakfire_jail* jail,
        const char* argv[], struct pakfire_env* env, int flags);
 
 int pakfire_jail_exec_capture_output(struct pakfire_jail* jail,
index 409cae44ab3c833a581febd61282abd1d8513a1f..3acd23958e57bc296b74be2bc1dc121d95de93ee 100644 (file)
@@ -1553,7 +1553,7 @@ ERROR:
        return r;
 }
 
-int pakfire_jail_exec(struct pakfire_jail* jail,
+int pakfire_jail_exec_command(struct pakfire_jail* jail,
                const char* argv[], struct pakfire_env* env, int flags) {
        struct pakfire_jail_command command = {
                .argv = argv,
@@ -1740,7 +1740,7 @@ int pakfire_jail_shell(struct pakfire_jail* jail) {
        }
 
        // Execute /bin/bash
-       r = pakfire_jail_exec(jail, argv, env, PAKFIRE_JAIL_INTERACTIVE);
+       r = pakfire_jail_exec_command(jail, argv, env, PAKFIRE_JAIL_INTERACTIVE);
        if (r < 0)
                goto ERROR;
 
index 47429149a4e29c7556ced577339f64014fe37109..15a97a3cc8d25381285fdbca84f5773199135acb 100644 (file)
@@ -124,7 +124,7 @@ static int test_stats(const struct test* t) {
 
        // Run a few things
        for (unsigned int i = 0; i < 3; i++) {
-               ASSERT_SUCCESS(pakfire_jail_exec(jail, argv, NULL, 0));
+               ASSERT_SUCCESS(pakfire_jail_exec_command(jail, argv, NULL, 0));
        }
 
        // Try reading the stats into some invalid space
index d93e20f4e8766bcc44efa9e9cb367343b2f61ba1..b4f8130d78a143c0aa91dbba73b76424d97e72b7 100644 (file)
@@ -68,7 +68,7 @@ static int test_exit_code(const struct test* t) {
        ASSERT_SUCCESS(pakfire_jail_create(&jail, t->pakfire));
 
        // Check if we receive the correct exit code
-       ASSERT(pakfire_jail_exec(jail, argv, NULL, 0) == 123);
+       ASSERT(pakfire_jail_exec_command(jail, argv, NULL, 0) == 123);
 
        // Success
        r = EXIT_SUCCESS;
@@ -92,7 +92,7 @@ static int test_segv(const struct test* t) {
        ASSERT_SUCCESS(pakfire_jail_create(&jail, t->pakfire));
 
        // Check if we receive the correct exit code
-       ASSERT(pakfire_jail_exec(jail, argv, NULL, 0) == 139);
+       ASSERT(pakfire_jail_exec_command(jail, argv, NULL, 0) == 139);
 
        // Success
        r = EXIT_SUCCESS;
@@ -143,7 +143,7 @@ static int test_launch_into_cgroup(const struct test* t) {
        ASSERT_SUCCESS(pakfire_jail_set_cgroup(jail, cgroup));
 
        // Run command
-       ASSERT(pakfire_jail_exec(jail, cmd_hello_world, NULL, 0) == 0);
+       ASSERT(pakfire_jail_exec_command(jail, cmd_hello_world, NULL, 0) == 0);
 
        r = EXIT_SUCCESS;
 
@@ -212,10 +212,10 @@ static int test_memory_limit(const struct test* t) {
        ASSERT_SUCCESS(pakfire_cgroup_set_memory_limit(cgroup, 100 * 1024 * 1024));
 
        // Try to exhaust all memory
-       ASSERT_FAILURE(pakfire_jail_exec(jail, cmd_exhaust_memory, NULL, 0));
+       ASSERT_FAILURE(pakfire_jail_exec_command(jail, cmd_exhaust_memory, NULL, 0));
 
        // A fork bomb should also exhaust all memory
-       ASSERT_FAILURE(pakfire_jail_exec(jail, cmd_fork_bomb, NULL, 0));
+       ASSERT_FAILURE(pakfire_jail_exec_command(jail, cmd_fork_bomb, NULL, 0));
 
        // Success
        r = EXIT_SUCCESS;
@@ -249,7 +249,7 @@ static int test_pid_limit(const struct test* t) {
        ASSERT_SUCCESS(pakfire_cgroup_set_pid_limit(cgroup, 100));
 
        // Try to fork as many processes as possible
-       ASSERT_FAILURE(pakfire_jail_exec(jail, cmd_fork_bomb, NULL, 0));
+       ASSERT_FAILURE(pakfire_jail_exec_command(jail, cmd_fork_bomb, NULL, 0));
 
        // Success
        r = EXIT_SUCCESS;
@@ -307,7 +307,7 @@ static int test_bind(const struct test* t) {
        ASSERT_SUCCESS(pakfire_jail_bind(jail, source, target, MS_RDONLY));
 
        // Check if the mount actually works
-       ASSERT_SUCCESS(pakfire_jail_exec(jail, argv, NULL, 0));
+       ASSERT_SUCCESS(pakfire_jail_exec_command(jail, argv, NULL, 0));
 
        // Success
        r = EXIT_SUCCESS;
@@ -376,7 +376,7 @@ static int test_send_one_signal(const struct test* t,
        };
 
        // Perform the command
-       return pakfire_jail_exec(jail, argv, NULL, 0);
+       return pakfire_jail_exec_command(jail, argv, NULL, 0);
 }
 
 static int test_send_signal(const struct test* t) {
@@ -420,7 +420,7 @@ static int test_timeout(const struct test* t) {
        ASSERT_SUCCESS(pakfire_jail_set_timeout(jail, 1));
 
        // Check if we receive the correct exit code
-       ASSERT(pakfire_jail_exec(jail, argv, NULL, 0) == 139);
+       ASSERT(pakfire_jail_exec_command(jail, argv, NULL, 0) == 139);
 
        // Success
        r = EXIT_SUCCESS;