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>
This commit is contained in:
@@ -422,7 +422,7 @@ weston_log_ctx_compositor_destroy(struct weston_compositor *compositor)
|
|||||||
wl_global_destroy(log_ctx->global);
|
wl_global_destroy(log_ctx->global);
|
||||||
|
|
||||||
wl_list_for_each(scope, &log_ctx->scope_list, compositor_link)
|
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);
|
scope->name);
|
||||||
|
|
||||||
/* Remove head to not crash if scope removed later. */
|
/* 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)
|
if (!log_ctx->global)
|
||||||
return;
|
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 "
|
"This is a potential denial-of-service attack vector and "
|
||||||
"information leak.\n");
|
"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;
|
struct weston_log_subscription *pending_sub = NULL;
|
||||||
|
|
||||||
if (!name || !description) {
|
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;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!log_ctx) {
|
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);
|
name);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (weston_log_get_scope(log_ctx, name)){
|
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);
|
name);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
scope = zalloc(sizeof *scope);
|
scope = zalloc(sizeof *scope);
|
||||||
if (!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);
|
name);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -573,7 +573,7 @@ weston_compositor_add_log_scope(struct weston_log_context *log_ctx,
|
|||||||
wl_list_init(&scope->subscription_list);
|
wl_list_init(&scope->subscription_list);
|
||||||
|
|
||||||
if (!scope->name || !scope->desc) {
|
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);
|
name);
|
||||||
free(scope->name);
|
free(scope->name);
|
||||||
free(scope->desc);
|
free(scope->desc);
|
||||||
|
|||||||
Reference in New Issue
Block a user