X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fcommon%2Frunas.cpp;fp=src%2Fcommon%2Frunas.cpp;h=7651470c8c57336f5f2c995c886d60f02e143e78;hp=d253ee0544e5317183b1a01becfc87a11cbd5ed5;hb=5c7248cd5bce45bf64d563fb4e130a63bf345f11;hpb=cd9adb8b829564212158943a0d279bb35322ab30 diff --git a/src/common/runas.cpp b/src/common/runas.cpp index d253ee054..7651470c8 100644 --- a/src/common/runas.cpp +++ b/src/common/runas.cpp @@ -177,30 +177,31 @@ struct run_as_ret { bool _error; } LTTNG_PACKED; -#define COMMAND_IN_FDS(data_ptr) \ - ({ \ - int *fds = NULL; \ - if (command_properties[data_ptr->cmd].in_fds_offset != -1) { \ - fds = (int *) ((char *) data_ptr + \ - command_properties[data_ptr->cmd].in_fds_offset); \ - } \ - fds; \ +#define COMMAND_IN_FDS(data_ptr) \ + ({ \ + int *fds = NULL; \ + if (command_properties[(data_ptr)->cmd].in_fds_offset != -1) { \ + fds = (int *) ((char *) (data_ptr) + \ + command_properties[(data_ptr)->cmd].in_fds_offset); \ + } \ + fds; \ }) -#define COMMAND_OUT_FDS(cmd, ret_ptr) \ - ({ \ - int *fds = NULL; \ - if (command_properties[cmd].out_fds_offset != -1) { \ - fds = (int *) ((char *) ret_ptr + command_properties[cmd].out_fds_offset); \ - } \ - fds; \ +#define COMMAND_OUT_FDS(cmd, ret_ptr) \ + ({ \ + int *fds = NULL; \ + if (command_properties[cmd].out_fds_offset != -1) { \ + fds = (int *) ((char *) (ret_ptr) + \ + command_properties[cmd].out_fds_offset); \ + } \ + fds; \ }) -#define COMMAND_IN_FD_COUNT(data_ptr) ({ command_properties[data_ptr->cmd].in_fd_count; }) +#define COMMAND_IN_FD_COUNT(data_ptr) ({ command_properties[(data_ptr)->cmd].in_fd_count; }) #define COMMAND_OUT_FD_COUNT(cmd) ({ command_properties[cmd].out_fd_count; }) -#define COMMAND_USE_CWD_FD(data_ptr) command_properties[data_ptr->cmd].use_cwd_fd +#define COMMAND_USE_CWD_FD(data_ptr) command_properties[(data_ptr)->cmd].use_cwd_fd struct run_as_command_properties { /* Set to -1 when not applicable. */