Fixed possible bug in VM. Added coverity rules to makefiles.
authorDale Weiler <killfieldengine@gmail.com>
Sat, 22 Jun 2013 00:15:25 +0000 (00:15 +0000)
committerDale Weiler <killfieldengine@gmail.com>
Sat, 22 Jun 2013 00:15:25 +0000 (00:15 +0000)
BSDmakefile
Makefile
exec.c

index 947f3839a267f7c29cb477f968f296a723fbbfca..76149683d18f423e111b494883d9311687ff0fcb 100644 (file)
@@ -79,6 +79,12 @@ gource-record:
 depend:
        @makedepend -Y -f BSDmakefile -w 65536 2> /dev/null ${DEPS:C/\.o/.c/g}
 
+coverity:
+       @cov-build --dir cov-int $(MAKE) -f BSDmakefile
+       @tar czf gm-qcc.tgz cov-int
+       @rm -rf cov-int
+       @echo gm-qcc.tgz generated, submit for analysis
+
 install: install-gmqcc install-qcvm install-gmqpak install-doc
 install-gmqcc: $(GMQCC)
        install -d -m755              $(DESTDIR)$(BINDIR)
index 3ab21a810476f5113507b445434a49850f3afda5..4ba2bcdf4a39228a3dad94965bec6fdac5d609cb 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -115,6 +115,13 @@ gource-record:
 depend:
        @ makedepend -Y -w 65536 2> /dev/null $(subst .o,.c,$(DEPS))
 
+
+coverity:
+       @cov-build --dir cov-int $(MAKE)
+       @tar czf gm-qcc.tgz cov-int
+       @rm -rf cov-int
+       @echo gm-qcc.tgz generated, submit for analysis
+
 #install rules
 install: install-gmqcc install-qcvm install-gmqpak install-doc
 install-gmqcc: $(GMQCC)
diff --git a/exec.c b/exec.c
index dccee5ed121205936fd05c2c9804dea8d6381cab..00f32f1c24060ae10708685d8024e02c736eea9f 100644 (file)
--- a/exec.c
+++ b/exec.c
@@ -304,7 +304,9 @@ static void trace_print_global(qc_program *prog, unsigned int glob, int vtype) {
     int       len;
 
     if (!glob) {
-        len = printf("<null>,");
+        if ((len = printf("<null>,")) == -1)
+            len = 0;
+
         goto done;
     }