* [PATCH] tools/xenstat: handle network interface name in upper case.
@ 2016-03-11 20:13 Zhigang Wang
2016-03-11 20:21 ` Zhigang Wang
0 siblings, 1 reply; 2+ messages in thread
From: Zhigang Wang @ 2016-03-11 20:13 UTC (permalink / raw)
To: xen-devel; +Cc: Zhigang Wang, Ian Jackson, Ian Campbell, Stefano Stabellini
Oracle-Bug: 22879856
Signed-off-by: Zhigang Wang <zhigang.x.wang@oracle.com>
---
tools/xenstat/libxenstat/src/xenstat_linux.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/tools/xenstat/libxenstat/src/xenstat_linux.c b/tools/xenstat/libxenstat/src/xenstat_linux.c
index 931b24e..d33eca1 100644
--- a/tools/xenstat/libxenstat/src/xenstat_linux.c
+++ b/tools/xenstat/libxenstat/src/xenstat_linux.c
@@ -101,6 +101,7 @@ int parseNetDevLine(char *line, char *iface, unsigned long long *rxBytes, unsign
/* Temporary/helper variables */
int ret;
char *tmp;
+ char *tmp2;
int i = 0, x = 0, col = 0;
regex_t r;
regmatch_t matches[19];
@@ -221,8 +222,11 @@ int parseNetDevLine(char *line, char *iface, unsigned long long *rxBytes, unsign
}
else
/* There were errors when parsing this directly in RE. strpbrk() helps */
- if (iface != NULL)
- strcpy(iface, strpbrk(tmp, "abcdefghijklmnopqrstvuwxyz0123456789"));
+ if (iface != NULL) {
+ tmp2 = strpbrk(tmp, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");
+ if (tmp2 != NULL)
+ strcpy(iface, tmp2);
+ }
memset(tmp, 0, matches[i].rm_eo - matches[i].rm_so);
}
--
2.5.0
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] tools/xenstat: handle network interface name in upper case.
2016-03-11 20:13 [PATCH] tools/xenstat: handle network interface name in upper case Zhigang Wang
@ 2016-03-11 20:21 ` Zhigang Wang
0 siblings, 0 replies; 2+ messages in thread
From: Zhigang Wang @ 2016-03-11 20:21 UTC (permalink / raw)
To: xen-devel; +Cc: Ian Jackson, Ian Campbell, Stefano Stabellini
Sorry I send this mail by mistake. Please ignore it. I send another one with correct commit message.
On 03/11/2016 03:13 PM, Zhigang Wang wrote:
> Oracle-Bug: 22879856
>
> Signed-off-by: Zhigang Wang <zhigang.x.wang@oracle.com>
> ---
> tools/xenstat/libxenstat/src/xenstat_linux.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/tools/xenstat/libxenstat/src/xenstat_linux.c b/tools/xenstat/libxenstat/src/xenstat_linux.c
> index 931b24e..d33eca1 100644
> --- a/tools/xenstat/libxenstat/src/xenstat_linux.c
> +++ b/tools/xenstat/libxenstat/src/xenstat_linux.c
> @@ -101,6 +101,7 @@ int parseNetDevLine(char *line, char *iface, unsigned long long *rxBytes, unsign
> /* Temporary/helper variables */
> int ret;
> char *tmp;
> + char *tmp2;
> int i = 0, x = 0, col = 0;
> regex_t r;
> regmatch_t matches[19];
> @@ -221,8 +222,11 @@ int parseNetDevLine(char *line, char *iface, unsigned long long *rxBytes, unsign
> }
> else
> /* There were errors when parsing this directly in RE. strpbrk() helps */
> - if (iface != NULL)
> - strcpy(iface, strpbrk(tmp, "abcdefghijklmnopqrstvuwxyz0123456789"));
> + if (iface != NULL) {
> + tmp2 = strpbrk(tmp, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");
> + if (tmp2 != NULL)
> + strcpy(iface, tmp2);
> + }
>
> memset(tmp, 0, matches[i].rm_eo - matches[i].rm_so);
> }
>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-03-11 20:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-11 20:13 [PATCH] tools/xenstat: handle network interface name in upper case Zhigang Wang
2016-03-11 20:21 ` Zhigang Wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).