Skip to content

Instantly share code, notes, and snippets.

@ThomasAdam
Created January 16, 2013 14:21
Show Gist options
  • Select an option

  • Save ThomasAdam/4547398 to your computer and use it in GitHub Desktop.

Select an option

Save ThomasAdam/4547398 to your computer and use it in GitHub Desktop.
diff --git a/fvwm/misc.c b/fvwm/misc.c
index f303453..16023d0 100644
--- a/fvwm/misc.c
+++ b/fvwm/misc.c
@@ -348,6 +348,7 @@ void fvwm_msg(fvwm_msg_t type, char *id, char *msg, ...)
va_list args;
char fvwm_id[20];
char time_str[40] = "\0";
+ char *fmt;
#ifdef FVWM_DEBUG_TIME
clock_t time_val, time_taken;
static clock_t start_time = 0;
@@ -388,9 +389,12 @@ void fvwm_msg(fvwm_msg_t type, char *id, char *msg, ...)
}
else
{
+ asprintf(&fmt, "%s", msg);
va_start(args, msg);
- vfprintf(stderr, msg, args);
+ vfprintf(stderr, fmt, args);
va_end(args);
+
+ free(fmt);
}
fprintf(stderr, "\n");
diff --git a/libs/FRenderInit.c b/libs/FRenderInit.c
index fcdb259..65bff1a 100644
--- a/libs/FRenderInit.c
+++ b/libs/FRenderInit.c
@@ -129,7 +129,7 @@ Bool FRenderGetErrorText(int code, char *msg)
code <= FRenderErrorBase +
(sizeof(error_names) / sizeof(char *)) -1)
{
- sprintf(msg, error_names[code - FRenderErrorBase]);
+ sprintf(msg, "%s", error_names[code - FRenderErrorBase]);
return 1;
}
}
diff --git a/modules/FvwmIconMan/debug.c b/modules/FvwmIconMan/debug.c
index 9b5c194..9a7afb5 100644
--- a/modules/FvwmIconMan/debug.c
+++ b/modules/FvwmIconMan/debug.c
@@ -38,14 +38,18 @@ void
ConsoleMessage(const char *fmt, ...)
{
va_list args;
+ char *mfmt;
assert(console != NULL);
fputs("FvwmIconMan: ", console);
+ asprintf(&mfmt, "%s", fmt);
va_start(args, fmt);
- vfprintf(console, fmt, args);
+ vfprintf(console, mfmt, args);
va_end(args);
+
+ free(mfmt);
}
int
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment