projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: utils: unhandled close return value
[lttng-tools.git]
/
src
/
common
/
runas.cpp
diff --git
a/src/common/runas.cpp
b/src/common/runas.cpp
index d5b53f2dc29ab31f6ecb99b49b70a64ec1e462bc..2c762d5ee797f3a98c92f1f59527a1a9ae92f37c 100644
(file)
--- a/
src/common/runas.cpp
+++ b/
src/common/runas.cpp
@@
-43,10
+43,6
@@
#define GETPW_BUFFER_FALLBACK_SIZE 4096
#define GETPW_BUFFER_FALLBACK_SIZE 4096
-struct run_as_data;
-struct run_as_ret;
-typedef int (*run_as_fct)(struct run_as_data *data, struct run_as_ret *ret_value);
-
enum run_as_cmd {
RUN_AS_MKDIR,
RUN_AS_MKDIRAT,
enum run_as_cmd {
RUN_AS_MKDIR,
RUN_AS_MKDIRAT,
@@
-67,6
+63,11
@@
enum run_as_cmd {
RUN_AS_GENERATE_FILTER_BYTECODE,
};
RUN_AS_GENERATE_FILTER_BYTECODE,
};
+namespace {
+struct run_as_data;
+struct run_as_ret;
+typedef int (*run_as_fct)(struct run_as_data *data, struct run_as_ret *ret_value);
+
struct run_as_mkdir_data {
int dirfd;
char path[LTTNG_PATH_MAX];
struct run_as_mkdir_data {
int dirfd;
char path[LTTNG_PATH_MAX];
@@
-210,7
+211,7
@@
struct run_as_command_properties {
bool use_cwd_fd;
};
bool use_cwd_fd;
};
-
static
const struct run_as_command_properties command_properties[] = {
+const struct run_as_command_properties command_properties[] = {
{
.in_fds_offset = offsetof(struct run_as_data, u.mkdir.dirfd),
.out_fds_offset = -1,
{
.in_fds_offset = offsetof(struct run_as_data, u.mkdir.dirfd),
.out_fds_offset = -1,
@@
-341,9
+342,10
@@
struct run_as_worker_data {
};
/* Single global worker per process (for now). */
};
/* Single global worker per process (for now). */
-
static
run_as_worker_data *global_worker;
+run_as_worker_data *global_worker;
/* Lock protecting the worker. */
/* Lock protecting the worker. */
-static pthread_mutex_t worker_lock = PTHREAD_MUTEX_INITIALIZER;
+pthread_mutex_t worker_lock = PTHREAD_MUTEX_INITIALIZER;
+} /* namespace */
#ifdef VALGRIND
static
#ifdef VALGRIND
static
@@
-930,7
+932,7
@@
static int get_user_infos_from_uid(
get_pw_buf_size = (size_t) raw_get_pw_buf_size;
get_pw_buf_size = (size_t) raw_get_pw_buf_size;
- buf =
(char *) zmalloc
(get_pw_buf_size);
+ buf =
calloc<char>
(get_pw_buf_size);
if (buf == NULL) {
PERROR("Failed to allocate buffer to get password file entries");
goto error;
if (buf == NULL) {
PERROR("Failed to allocate buffer to get password file entries");
goto error;
@@
-1458,7
+1460,7
@@
int run_as_create_worker_no_lock(const char *procname,
ret = 0;
goto end;
}
ret = 0;
goto end;
}
- worker =
(run_as_worker_data *) zmalloc(sizeof(*worker)
);
+ worker =
zmalloc<run_as_worker_data>(
);
if (!worker) {
ret = -ENOMEM;
goto end;
if (!worker) {
ret = -ENOMEM;
goto end;
@@
-1959,7
+1961,7
@@
int run_as_extract_sdt_probe_offsets(int fd, const char* provider_name,
}
*num_offset = run_as_ret.u.extract_sdt_probe_offsets.num_offset;
}
*num_offset = run_as_ret.u.extract_sdt_probe_offsets.num_offset;
- *offsets =
(uint64_t *) zmalloc(*num_offset * sizeof(uint64_t)
);
+ *offsets =
calloc<uint64_t>(*num_offset
);
if (!*offsets) {
ret = -ENOMEM;
goto error;
if (!*offsets) {
ret = -ENOMEM;
goto error;
@@
-2001,7
+2003,7
@@
int run_as_generate_filter_bytecode(const char *filter_expression,
view_bytecode = (const struct lttng_bytecode *) run_as_ret.u.generate_filter_bytecode.bytecode;
view_bytecode = (const struct lttng_bytecode *) run_as_ret.u.generate_filter_bytecode.bytecode;
- local_bytecode =
(lttng_bytecode *) zmalloc(sizeof(*local_bytecode) +
view_bytecode->len);
+ local_bytecode =
calloc<lttng_bytecode>(
view_bytecode->len);
if (!local_bytecode) {
ret = -ENOMEM;
goto error;
if (!local_bytecode) {
ret = -ENOMEM;
goto error;
This page took
0.024155 seconds
and
4
git commands to generate.