Ian Campbell
2010-Sep-06 12:59 UTC
[Xen-devel] [PATCH] xl: libxl_dominfo.shutdown_reason is a number not a string
# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1283777932 -3600
# Node ID 13554f2ce7cd77476feb9e048886c3ecd06ddb23
# Parent ae868d6aee2a209bcac10c2bc1dd59986b469823
xl: libxl_dominfo.shutdown_reason is a number not a string
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
diff -r ae868d6aee2a -r 13554f2ce7cd tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c Mon Sep 06 13:31:50 2010 +0100
+++ b/tools/libxl/xl_cmdimpl.c Mon Sep 06 13:58:52 2010 +0100
@@ -1123,7 +1123,7 @@ static int handle_domain_death(libxl_ctx
action = d_config->on_watchdog;
break;
default:
- LOG("Unknown shutdown reason code %s. Destroying domain.",
info->shutdown_reason);
+ LOG("Unknown shutdown reason code %d. Destroying domain.",
info->shutdown_reason);
action = ACTION_DESTROY;
}
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Ian Jackson
2010-Sep-08 15:36 UTC
Re: [Xen-devel] [PATCH] xl: libxl_dominfo.shutdown_reason is a number not a string
Ian Campbell writes ("[Xen-devel] [PATCH] xl: libxl_dominfo.shutdown_reason
is a number not a string"):> xl: libxl_dominfo.shutdown_reason is a number not a string
Thanks. I added __attribute__((format..)) to the appropriate place,
and that found an additional bug. I have that improvement, the other
fix, and your patch, all together.
# HG changeset patch
# User Ian Jackson <Ian.Jackson@eu.citrix.com>
# Date 1283960140 -3600
# Node ID 9d6fcb72ae5f24704c592e3600b6f406c80dec7f
# Parent fc866633d0ebb7b0982c5d5ddd62d3a7a70e6d5b
xl: correct calls to dolog() (aka LOG)
dolog, for which LOG is a macro wrapper, was lacking the printf format
attribute. Add it, and fix the two problems revealed.
(Original patch for one of the occurrences from Ian Campbell.)
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
diff -r fc866633d0eb -r 9d6fcb72ae5f tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c Wed Sep 08 16:24:20 2010 +0100
+++ b/tools/libxl/xl_cmdimpl.c Wed Sep 08 16:35:40 2010 +0100
@@ -235,6 +235,9 @@ static void find_domain(const char *p)
}
#define LOG(_f, _a...) dolog(__FILE__, __LINE__, __func__, _f "\n",
##_a)
+
+static void dolog(const char *file, int line, const char *func, char *fmt, ...)
+ __attribute__((format(printf,4,5)));
static void dolog(const char *file, int line, const char *func, char *fmt, ...)
{
@@ -1123,7 +1126,7 @@ static int handle_domain_death(libxl_ctx
action = d_config->on_watchdog;
break;
default:
- LOG("Unknown shutdown reason code %s. Destroying domain.",
info->shutdown_reason);
+ LOG("Unknown shutdown reason code %d. Destroying domain.",
info->shutdown_reason);
action = ACTION_DESTROY;
}
@@ -1537,7 +1540,7 @@ start:
}
rc = libxl_create_logfile(&ctx, name, &fullname);
if (rc) {
- LOG("failed to open logfile
%s",fullname,strerror(errno));
+ LOG("failed to open logfile %s:
%s",fullname,strerror(errno));
exit(-1);
}
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Ian Campbell
2010-Sep-08 15:46 UTC
Re: [Xen-devel] [PATCH] xl: libxl_dominfo.shutdown_reason is a number not a string
Thanks, looks sane to me. On Wed, 2010-09-08 at 16:36 +0100, Ian Jackson wrote:> Ian Campbell writes ("[Xen-devel] [PATCH] xl: libxl_dominfo.shutdown_reason is a number not a string"): > > xl: libxl_dominfo.shutdown_reason is a number not a string > > Thanks. I added __attribute__((format..)) to the appropriate place, > and that found an additional bug. I have that improvement, the other > fix, and your patch, all together. > > # HG changeset patch > # User Ian Jackson <Ian.Jackson@eu.citrix.com> > # Date 1283960140 -3600 > # Node ID 9d6fcb72ae5f24704c592e3600b6f406c80dec7f > # Parent fc866633d0ebb7b0982c5d5ddd62d3a7a70e6d5b > xl: correct calls to dolog() (aka LOG) > > dolog, for which LOG is a macro wrapper, was lacking the printf format > attribute. Add it, and fix the two problems revealed. > > (Original patch for one of the occurrences from Ian Campbell.) > > Signed-off-by: Ian Campbell <ian.campbell@citrix.com> > Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> > > diff -r fc866633d0eb -r 9d6fcb72ae5f tools/libxl/xl_cmdimpl.c > --- a/tools/libxl/xl_cmdimpl.c Wed Sep 08 16:24:20 2010 +0100 > +++ b/tools/libxl/xl_cmdimpl.c Wed Sep 08 16:35:40 2010 +0100 > @@ -235,6 +235,9 @@ static void find_domain(const char *p) > } > > #define LOG(_f, _a...) dolog(__FILE__, __LINE__, __func__, _f "\n", ##_a) > + > +static void dolog(const char *file, int line, const char *func, char *fmt, ...) > + __attribute__((format(printf,4,5))); > > static void dolog(const char *file, int line, const char *func, char *fmt, ...) > { > @@ -1123,7 +1126,7 @@ static int handle_domain_death(libxl_ctx > action = d_config->on_watchdog; > break; > default: > - LOG("Unknown shutdown reason code %s. Destroying domain.", info->shutdown_reason); > + LOG("Unknown shutdown reason code %d. Destroying domain.", info->shutdown_reason); > action = ACTION_DESTROY; > } > > @@ -1537,7 +1540,7 @@ start: > } > rc = libxl_create_logfile(&ctx, name, &fullname); > if (rc) { > - LOG("failed to open logfile %s",fullname,strerror(errno)); > + LOG("failed to open logfile %s: %s",fullname,strerror(errno)); > exit(-1); > } > >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel