1.1 --- a/fsaccess/fsaccess.c Mon Jan 15 23:44:56 2024 +0100
1.2 +++ b/fsaccess/fsaccess.c Wed Jan 17 00:52:03 2024 +0100
1.3 @@ -78,6 +78,7 @@
1.4
1.5 char **args;
1.6 int num_args;
1.7 + int exitcode;
1.8 enum op_results op_result;
1.9
1.10 /* Parse program options and initialise the argument details. */
1.11 @@ -96,7 +97,7 @@
1.12
1.13 /* Perform the requested operation. */
1.14
1.15 - op_result = run_operation(args[0], num_args - 1, &args[1]);
1.16 + op_result = run_operation(args[0], num_args - 1, &args[1], &exitcode);
1.17 return handle_op_result(args[0], op_result);
1.18 }
1.19
2.1 --- a/fsaccess/op_run.c Mon Jan 15 23:44:56 2024 +0100
2.2 +++ b/fsaccess/op_run.c Wed Jan 17 00:52:03 2024 +0100
2.3 @@ -56,7 +56,7 @@
2.4 if (err)
2.5 {
2.6 printf("Could not obtain pipe: %s\n", l4sys_errtostr(err));
2.7 - return 1;
2.8 + return -1;
2.9 }
2.10
2.11 /* Start the process. */
2.12 @@ -66,7 +66,7 @@
2.13 if (err)
2.14 {
2.15 printf("Could not start process: %s\n", l4sys_errtostr(err));
2.16 - return 1;
2.17 + return -1;
2.18 }
2.19
2.20 printf("Finished program initiation.\n");
2.21 @@ -96,9 +96,9 @@
2.22 printf("End process (flags %" pFMTnotify_flags "x values: %ld, %ld)\n", flags, values.sig, values.val);
2.23
2.24 if (err)
2.25 - return 1;
2.26 + return -1;
2.27
2.28 - return 0;
2.29 + return values.val;
2.30 }
2.31
2.32 /* vim: tabstop=2 expandtab shiftwidth=2
3.1 --- a/fsaccess/op_script.c Mon Jan 15 23:44:56 2024 +0100
3.2 +++ b/fsaccess/op_script.c Wed Jan 17 00:52:03 2024 +0100
3.3 @@ -45,6 +45,7 @@
3.4 char buffer[BUFSIZE];
3.5 enum op_results op_result;
3.6 int num_args;
3.7 + int exitcode;
3.8 char *args[MAX_ARGS];
3.9 int i, use_stdin;
3.10
3.11 @@ -77,7 +78,7 @@
3.12
3.13 if (num_args >= 1)
3.14 {
3.15 - op_result = run_operation(args[0], num_args - 1, &args[1]);
3.16 + op_result = run_operation(args[0], num_args - 1, &args[1], &exitcode);
3.17
3.18 if (handle_op_result(args[0], op_result) && !use_stdin)
3.19 return 1;
4.1 --- a/fsaccess/ops.c Mon Jan 15 23:44:56 2024 +0100
4.2 +++ b/fsaccess/ops.c Wed Jan 17 00:52:03 2024 +0100
4.3 @@ -52,17 +52,16 @@
4.4
4.5 /* Invocation of operations. */
4.6
4.7 -enum op_results run_operation(const char *operation, int argc, char *argv[])
4.8 +enum op_results run_operation(const char *operation, int argc, char *argv[], int *exitcode)
4.9 {
4.10 struct operation *op;
4.11 - int exitcode;
4.12
4.13 for (op = &operations[0]; op->name != NULL; op++)
4.14 {
4.15 if (!strcmp(operation, op->name))
4.16 {
4.17 - exitcode = op->fn(argc, argv);
4.18 - if (exitcode)
4.19 + *exitcode = op->fn(argc, argv);
4.20 + if (*exitcode)
4.21 return OP_FAILED;
4.22 break;
4.23 }
5.1 --- a/fsaccess/ops.h Mon Jan 15 23:44:56 2024 +0100
5.2 +++ b/fsaccess/ops.h Wed Jan 17 00:52:03 2024 +0100
5.3 @@ -31,7 +31,8 @@
5.4 };
5.5
5.6 int handle_op_result(const char *operation, enum op_results op_result);
5.7 -enum op_results run_operation(const char *operation, int argc, char *argv[]);
5.8 +enum op_results run_operation(const char *operation, int argc, char *argv[],
5.9 + int *exitcode);
5.10
5.11 /* Operations exposed by the program. */
5.12