Ver código fonte

- get_max_procs() will log a bug and abort() if used too early (e.g.
from mod_init())

Andrei Pelinescu-Onciul 19 anos atrás
pai
commit
2db960ff4a
2 arquivos alterados com 6 adições e 1 exclusões
  1. 1 1
      Makefile.defs
  2. 5 0
      pt.c

+ 1 - 1
Makefile.defs

@@ -67,7 +67,7 @@ MAIN_NAME=ser
 VERSION = 0
 VERSION = 0
 PATCHLEVEL = 10
 PATCHLEVEL = 10
 SUBLEVEL =   99
 SUBLEVEL =   99
-EXTRAVERSION = -dev57-tm_fixes
+EXTRAVERSION = -dev58
 
 
 SER_VER = $(shell expr $(VERSION) \* 1000000 + $(PATCHLEVEL) \* 1000 + \
 SER_VER = $(shell expr $(VERSION) \* 1000000 + $(PATCHLEVEL) \* 1000 + \
 			$(SUBLEVEL) )
 			$(SUBLEVEL) )

+ 5 - 0
pt.c

@@ -115,6 +115,11 @@ int register_procs(int no)
 /* returns the maximum number of processes */
 /* returns the maximum number of processes */
 int get_max_procs()
 int get_max_procs()
 {
 {
+	if (pt==0){
+		LOG(L_CRIT, "BUG: get_max_procs() called too early "
+				"(it must _not_ be called from mod_init())\n");
+		abort(); /* crash to quickly catch offenders */
+	}
 	return estimated_proc_no;
 	return estimated_proc_no;
 }
 }