weston-log: Remove weston_log() calls from weston-log

Avoids a potential dependency on the log scope being set-up before
actually creating the scope. Destroy part of the log context could
suffer from the same issue if the log scope is destroyed before.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
dev
Marius Vlad 6 years ago
parent b599ad7701
commit ef4c268f68
  1. 14
      libweston/weston-log.c

@ -422,7 +422,7 @@ weston_log_ctx_compositor_destroy(struct weston_compositor *compositor)
wl_global_destroy(log_ctx->global);
wl_list_for_each(scope, &log_ctx->scope_list, compositor_link)
weston_log("Internal warning: debug scope '%s' has not been destroyed.\n",
fprintf(stderr, "Internal warning: debug scope '%s' has not been destroyed.\n",
scope->name);
/* Remove head to not crash if scope removed later. */
@ -472,7 +472,7 @@ weston_compositor_enable_debug_protocol(struct weston_compositor *compositor)
if (!log_ctx->global)
return;
weston_log("WARNING: debug protocol has been enabled. "
fprintf(stderr, "WARNING: debug protocol has been enabled. "
"This is a potential denial-of-service attack vector and "
"information leak.\n");
}
@ -543,25 +543,25 @@ weston_compositor_add_log_scope(struct weston_log_context *log_ctx,
struct weston_log_subscription *pending_sub = NULL;
if (!name || !description) {
weston_log("Error: cannot add a debug scope without name or description.\n");
fprintf(stderr, "Error: cannot add a debug scope without name or description.\n");
return NULL;
}
if (!log_ctx) {
weston_log("Error: cannot add debug scope '%s', infra not initialized.\n",
fprintf(stderr, "Error: cannot add debug scope '%s', infra not initialized.\n",
name);
return NULL;
}
if (weston_log_get_scope(log_ctx, name)){
weston_log("Error: debug scope named '%s' is already registered.\n",
fprintf(stderr, "Error: debug scope named '%s' is already registered.\n",
name);
return NULL;
}
scope = zalloc(sizeof *scope);
if (!scope) {
weston_log("Error adding debug scope '%s': out of memory.\n",
fprintf(stderr, "Error adding debug scope '%s': out of memory.\n",
name);
return NULL;
}
@ -573,7 +573,7 @@ weston_compositor_add_log_scope(struct weston_log_context *log_ctx,
wl_list_init(&scope->subscription_list);
if (!scope->name || !scope->desc) {
weston_log("Error adding debug scope '%s': out of memory.\n",
fprintf(stderr, "Error adding debug scope '%s': out of memory.\n",
name);
free(scope->name);
free(scope->desc);

Loading…
Cancel
Save