aboutsummaryrefslogtreecommitdiffstats
path: root/sway/config.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/config.c')
-rw-r--r--sway/config.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/sway/config.c b/sway/config.c
index f5efa98a..8c8c148d 100644
--- a/sway/config.c
+++ b/sway/config.c
@@ -924,23 +924,18 @@ void config_add_swaynag_warning(char *fmt, ...) {
924 if (config->reading && !config->validating) { 924 if (config->reading && !config->validating) {
925 va_list args; 925 va_list args;
926 va_start(args, fmt); 926 va_start(args, fmt);
927 size_t length = vsnprintf(NULL, 0, fmt, args) + 1; 927 char *str = vformat_str(fmt, args);
928 va_end(args); 928 va_end(args);
929 929 if (str == NULL) {
930 char *temp = malloc(length + 1);
931 if (!temp) {
932 sway_log(SWAY_ERROR, "Failed to allocate buffer for warning.");
933 return; 930 return;
934 } 931 }
935 932
936 va_start(args, fmt);
937 vsnprintf(temp, length, fmt, args);
938 va_end(args);
939
940 swaynag_log(config->swaynag_command, &config->swaynag_config_errors, 933 swaynag_log(config->swaynag_command, &config->swaynag_config_errors,
941 "Warning on line %i (%s) '%s': %s", 934 "Warning on line %i (%s) '%s': %s",
942 config->current_config_line_number, config->current_config_path, 935 config->current_config_line_number, config->current_config_path,
943 config->current_config_line, temp); 936 config->current_config_line, str);
937
938 free(str);
944 } 939 }
945} 940}
946 941