changeset 12708:4718d5dc3a28

6694511 svccfg export truncating opaque value type when byte length > 2048
author Tom Whitten <tom.whitten@oracle.com>
date Mon, 28 Jun 2010 08:02:28 -0700
parents b1f52998aafb
children 237fa25a1db0
files usr/src/cmd/svc/svccfg/svccfg_libscf.c
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/svc/svccfg/svccfg_libscf.c	Mon Jun 28 07:19:13 2010 -0700
+++ b/usr/src/cmd/svc/svccfg/svccfg_libscf.c	Mon Jun 28 08:02:28 2010 -0700
@@ -915,8 +915,14 @@
 		max_scf_len = max_scf_name_len;
 	if (max_scf_pg_type_len > max_scf_len)
 		max_scf_len = max_scf_pg_type_len;
-	if (max_scf_value_len > max_scf_len)
-		max_scf_len = max_scf_value_len;
+	/*
+	 * When a value of type opaque is represented as a string, the
+	 * string contains 2 characters for every byte of data.  That is
+	 * because the string contains the hex representation of the opaque
+	 * value.
+	 */
+	if (2 * max_scf_value_len > max_scf_len)
+		max_scf_len = 2 * max_scf_value_len;
 
 	if (atexit(remove_tempfile) != 0)
 		uu_die(gettext("Could not register atexit() function"));