ret_value->u.open.ret = open(data->u.open.path, data->u.open.flags, data->u.open.mode);
ret_value->fd = ret_value->u.open.ret;
ret_value->_errno = errno;
- ret_value->_error = (ret_value->u.open.ret) ? true : false;
+ ret_value->_error = ret_value->u.open.ret < 0;
return ret_value->u.open.ret;
}
return ret_value->u.rmdir_recursive.ret;
}
+#ifdef HAVE_ELF_H
static
int _extract_elf_symbol_offset(struct run_as_data *data,
struct run_as_ret *ret_value)
end:
return ret;
}
+#else
+static
+int _extract_elf_symbol_offset(struct run_as_data *data,
+ struct run_as_ret *ret_value)
+{
+ ERR("Unimplemented runas command RUN_AS_EXTRACT_ELF_SYMBOL_OFFSET");
+ return -1;
+}
+
+static
+int _extract_sdt_probe_offsets(struct run_as_data *data,
+ struct run_as_ret *ret_value)
+{
+ ERR("Unimplemented runas command RUN_AS_EXTRACT_SDT_PROBE_OFFSETS");
+ return -1;
+}
+#endif
static
run_as_fct run_as_enum_to_fct(enum run_as_cmd cmd)
worker->procname = strdup(procname);
if (!worker->procname) {
ret = -ENOMEM;
- goto end;
+ goto error_procname_alloc;
}
/* Create unix socket. */
if (lttcomm_create_anon_unix_socketpair(worker->sockpair) < 0) {
ret = -1;
}
worker->sockpair[1] = -1;
+ free(worker->procname);
+ free(worker);
LOG(ret ? PRINT_ERR : PRINT_DBG, "run_as worker exiting (ret = %d)", ret);
exit(ret ? EXIT_FAILURE : EXIT_SUCCESS);
} else {
worker->sockpair[i] = -1;
}
error_sock:
+ free(worker->procname);
+error_procname_alloc:
free(worker);
return ret;
}