* [PATCH] opensm: fix strtoull error handling
@ 2011-04-15 22:19 Ira Weiny
[not found] ` <20110415151922.cd760149.weiny2-i2BcT+NCU+M@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Ira Weiny @ 2011-04-15 22:19 UTC (permalink / raw)
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; +Cc: Alex Netes
Subject: [PATCH] opensm: fix strtoull error handling
The man page states that errno _may_ be returned when the string can not be
converted. Check that the entire string was consumed otherwise assume this is
not a guid.
Signed-off-by: Ira Weiny <weiny2-i2BcT+NCU+M@public.gmane.org>
---
opensm/osm_perfmgr.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/opensm/osm_perfmgr.c b/opensm/osm_perfmgr.c
index 3e1575a..1cbbb71 100644
--- a/opensm/osm_perfmgr.c
+++ b/opensm/osm_perfmgr.c
@@ -1419,8 +1419,9 @@ void osm_perfmgr_dump_counters(osm_perfmgr_t * pm, perfmgr_db_dump_t dump_type)
*******************************************************************/
void osm_perfmgr_print_counters(osm_perfmgr_t * pm, char *nodename, FILE * fp)
{
- uint64_t guid = strtoull(nodename, NULL, 0);
- if (guid == 0 && errno)
+ char *end = NULL;
+ uint64_t guid = strtoull(nodename, &end, 0);
+ if (nodename + strlen(nodename) != end)
perfmgr_db_print_by_name(pm->db, nodename, fp);
else
perfmgr_db_print_by_guid(pm->db, guid, fp);
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] opensm: fix strtoull error handling
[not found] ` <20110415151922.cd760149.weiny2-i2BcT+NCU+M@public.gmane.org>
@ 2011-04-17 15:13 ` Alex Netes
0 siblings, 0 replies; 2+ messages in thread
From: Alex Netes @ 2011-04-17 15:13 UTC (permalink / raw)
To: Ira Weiny; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
On 15:19 Fri 15 Apr , Ira Weiny wrote:
> Subject: [PATCH] opensm: fix strtoull error handling
>
> The man page states that errno _may_ be returned when the string can not be
> converted. Check that the entire string was consumed otherwise assume this is
> not a guid.
>
> Signed-off-by: Ira Weiny <weiny2-i2BcT+NCU+M@public.gmane.org>
> ---
Applied, thanks.
-- Alex
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-04-17 15:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-15 22:19 [PATCH] opensm: fix strtoull error handling Ira Weiny
[not found] ` <20110415151922.cd760149.weiny2-i2BcT+NCU+M@public.gmane.org>
2011-04-17 15:13 ` Alex Netes
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox