Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Prefix all messages with application name

  • Loading branch information...
commit 1d672092880cf35d695ef7f6b2b7aab61dfd7070 1 parent ece1935
Simon Gate authored
Showing with 8 additions and 1 deletion.
  1. +8 −1 msg.c
9 msg.c
View
@@ -40,11 +40,14 @@
void vfmsg(FILE *f,
const char *pre, const char *suf, const char *fmt,
va_list ap) {
- int prelen = 0, fmtlen = 0, suflen = 0;
+ int prelen = 0, fmtlen = 0, suflen = 0, proglen = 0;
+ char prog[30] = "[reattach-to-user-namespace] ";
+ proglen = strlen(prog);
if (pre) prelen = strlen(pre);
if (fmt) fmtlen = strlen(fmt);
if (suf) suflen = strlen(suf);
char *newfmt = malloc(
+ proglen*2 +
prelen*2 + /* %-doubled pre */
fmtlen +
2 + /* ':' and SP */
@@ -55,6 +58,10 @@ void vfmsg(FILE *f,
goto finish;
char *newfmt_end = newfmt;
+ if(proglen) {
+ strcpy(newfmt_end, prog);
+ newfmt_end += proglen;
+ }
if (prelen)
while(*pre)
if ((*newfmt_end++ = *pre++) == '%')
Please sign in to comment.
Something went wrong with that request. Please try again.