>From 3df0056cce46e521dc9f0ab07c55a41cef6f340c Mon Sep 17 00:00:00 2001 From: Ira K. Weiny <[EMAIL PROTECTED]> Date: Thu, 25 Oct 2007 10:09:54 -0700 Subject: [PATCH] Allow for a special value of "(null)" in the opts file.
Some string values are valid if they are "(null)". Special case this string
so that it sets the pointer to NULL when read.
Signed-off-by: Ira K. Weiny <[EMAIL PROTECTED]>
---
opensm/opensm/osm_subnet.c | 17 +++++++++++------
1 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/opensm/opensm/osm_subnet.c b/opensm/opensm/osm_subnet.c
index 9bc6940..32af508 100644
--- a/opensm/opensm/osm_subnet.c
+++ b/opensm/opensm/osm_subnet.c
@@ -630,12 +630,17 @@ opts_unpack_charp(IN char *p_req_key,
printf(buff);
cl_log_event("OpenSM", CL_LOG_INFO, buff, NULL, 0);
- /*
- Ignore the possible memory leak here;
- the pointer may be to a static default.
- */
- *p_val = (char *)malloc(strlen(p_val_str) + 1);
- strcpy(*p_val, p_val_str);
+ /* special case the "(null)" string */
+ if (strcmp("(null)", p_val_str) == 0) {
+ *p_val = NULL;
+ } else {
+ /*
+ Ignore the possible memory leak here;
+ the pointer may be to a static default.
+ */
+ *p_val = (char *)malloc(strlen(p_val_str) + 1);
+ strcpy(*p_val, p_val_str);
+ }
}
}
}
--
1.5.1
0006-Allow-for-a-special-value-of-null-in-the-opts-fi.patch
Description: Binary data
_______________________________________________ general mailing list [email protected] http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general
