aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Rees <maxcrees@me.com> 2021-01-03 04:58:47 -0500
committerMax Rees <maxcrees@me.com> 2021-01-03 04:58:47 -0500
commit53af8b630883d3e681a7de1048fe601609a2d9dc (patch)
tree01eec515d1cefb0c9248b021a7f19006614c081a
parent7b8a2834427936891db1f02e13067bcfda5a17d3 (diff)
comproot: make HANDLER_END a little more hygienic
-rw-r--r--src/comproot.h2
-rw-r--r--src/handlers/handle_chown.c6
-rw-r--r--src/handlers/handle_stat.c4
3 files changed, 6 insertions, 6 deletions
diff --git a/src/comproot.h b/src/comproot.h
index 3445c75..eca8cae 100644
--- a/src/comproot.h
+++ b/src/comproot.h
@@ -49,7 +49,7 @@ typedef void (*handler_func)(HANDLER_ARGS);
#define HANDLER_ID HANDLER_REQ->id
#define HANDLER_PID HANDLER_REQ->pid
#define HANDLER_ARG(i) HANDLER_REQ->data.args[i]
-#define HANDLER_END \
+#define HANDLER_END(rc) \
do { \
HANDLER_RESP->val = rc; \
HANDLER_RESP->error = rc ? -errno : 0; \
diff --git a/src/handlers/handle_chown.c b/src/handlers/handle_chown.c
index 9165790..8e05501 100644
--- a/src/handlers/handle_chown.c
+++ b/src/handlers/handle_chown.c
@@ -49,7 +49,7 @@ static void handle_chown_inner(char *syscall_name, HANDLER_ARGS, int follow) {
rc = record_chown(pathname, owner, group, follow);
out:
- HANDLER_END;
+ HANDLER_END(rc);
}
DECL_HANDLER(chown) {
@@ -76,7 +76,7 @@ DECL_HANDLER(fchown) {
rc = record_chown(procpath, owner, group, 0);
out:
- HANDLER_END;
+ HANDLER_END(rc);
}
DECL_HANDLER(fchownat) {
@@ -115,5 +115,5 @@ DECL_HANDLER(fchownat) {
rc = record_chown(fullpath, owner, group, !(flags & AT_SYMLINK_NOFOLLOW));
out:
- HANDLER_END;
+ HANDLER_END(rc);
}
diff --git a/src/handlers/handle_stat.c b/src/handlers/handle_stat.c
index 6c58f0e..84ab63b 100644
--- a/src/handlers/handle_stat.c
+++ b/src/handlers/handle_stat.c
@@ -38,7 +38,7 @@ static void handle_stat_inner(char *syscall_name, HANDLER_ARGS, int follow) {
rc = 0;
out:
- HANDLER_END;
+ HANDLER_END(rc);
}
DECL_HANDLER(stat) {
@@ -67,5 +67,5 @@ DECL_HANDLER(fstat) {
rc = 0;
out:
- HANDLER_END;
+ HANDLER_END(rc);
}