/* write pid file */
pidfile = fopen("/var/run/lcr.pid","w");
- fprintf(pidfile, "%d\n", getpid());
- fclose(pidfile);
+ if (pidfile)
+ {
+ fprintf(pidfile, "%d\n", getpid());
+ fclose(pidfile);
+ }
} else
/* if not start */
if (!!strcasecmp(argv[1],"start"))
goto free;
}
+#ifdef WITH_GSM
+ /* handle gsm */
+ if (options.gsm && gsm_init())
+ {
+ fprintf(stderr, "GSM initialization failed.\n");
+ goto free;
+ }
+#else
+ if (options.gsm)
+ {
+ fprintf(stderr, "GSM is enabled, but not compiled. Use --with-gsm while configure!\n");
+ goto free;
+ }
+#endif
+
/* read interfaces and open ports */
if (!read_interfaces())
{
all_idle = 0;
BUDETECT
+#ifdef WITH_GSM
+ /* handle gsm */
+ if (options.gsm)
+ while(handle_gsm())
+ all_idle = 0;
+#endif
+
+BUDETECT
+
#if 0
/* check for child to exit (eliminate zombies) */
if (waitpid(-1, NULL, WNOHANG) > 0)
if (created_misdn)
mISDN_deinitialize();
+#ifdef WITH_GSM
+ /* free gsm */
+ if (options.gsm)
+ gsm_exit(0);
+#endif
+
/* display memory leak */
#define MEMCHECK(a, b) \
if (b) \