Module Name:    src
Committed By:   christos
Date:           Wed Oct 21 13:43:49 UTC 2015

Modified Files:
        src/external/cddl/osnet/dist/tools/ctf/cvt: ctf.c

Log Message:
make too many struct or union members non-fatal.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c:1.8 src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c:1.9
--- src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c:1.8	Sat Feb  7 15:30:03 2015
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c	Wed Oct 21 09:43:49 2015
@@ -387,8 +387,9 @@ write_type(void *arg1, void *arg2)
 			i++; /* count up struct or union members */
 
 		if (i > CTF_MAX_VLEN) {
-			terminate("sou %s has too many members: %d > %d\n",
+			warning("sou %s has too many members: %d > %d\n",
 			    tdesc_name(tp), i, CTF_MAX_VLEN);
+			i = CTF_MAX_VLEN;
 		}
 
 		if (tp->t_type == STRUCT)
@@ -399,7 +400,8 @@ write_type(void *arg1, void *arg2)
 		write_sized_type_rec(b, &ctt, tp->t_size);
 
 		if (tp->t_size < CTF_LSTRUCT_THRESH) {
-			for (mp = tp->t_members; mp != NULL; mp = mp->ml_next) {
+			for (mp = tp->t_members; mp != NULL && i > 0;
+			    mp = mp->ml_next) {
 				offset = strtab_insert(&b->ctb_strtab,
 				    mp->ml_name);
 
@@ -413,9 +415,11 @@ write_type(void *arg1, void *arg2)
 					SWAP_16(ctm.ctm_offset);
 				}
 				ctf_buf_write(b, &ctm, sizeof (ctm));
+				i--;
 			}
 		} else {
-			for (mp = tp->t_members; mp != NULL; mp = mp->ml_next) {
+			for (mp = tp->t_members; mp != NULL && i > 0;
+			    mp = mp->ml_next) {
 				offset = strtab_insert(&b->ctb_strtab,
 				    mp->ml_name);
 
@@ -435,6 +439,7 @@ write_type(void *arg1, void *arg2)
 				}
 
 				ctf_buf_write(b, &ctlm, sizeof (ctlm));
+				i--;
 			}
 		}
 		break;

Reply via email to