Browse Source

Merge pull request #1 from gfto/master

merge from gfto/mptsd
Ning 7 years ago
parent
commit
9fa1d8bdf2
5 changed files with 11 additions and 6 deletions
  1. 5
    0
      Makefile
  2. 2
    2
      config.c
  3. 2
    2
      mptsd.c
  4. 1
    1
      network.c
  5. 1
    1
      output_psi.c

+ 5
- 0
Makefile View File

13
 RM = /bin/rm -f
13
 RM = /bin/rm -f
14
 Q = @
14
 Q = @
15
 
15
 
16
+uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
17
+ifeq ($(uname_S),Darwin)
18
+LIBS = -lpthread -lm
19
+else
16
 LIBS = -lpthread -lm -lrt
20
 LIBS = -lpthread -lm -lrt
21
+endif
17
 
22
 
18
 FUNCS_DIR = libfuncs
23
 FUNCS_DIR = libfuncs
19
 FUNCS_LIB = $(FUNCS_DIR)/libfuncs.a
24
 FUNCS_LIB = $(FUNCS_DIR)/libfuncs.a

+ 2
- 2
config.c View File

403
 
403
 
404
 extern char *program_id;
404
 extern char *program_id;
405
 
405
 
406
-static void show_usage() {
406
+static void show_usage(void) {
407
 	printf("%s\n", program_id);
407
 	printf("%s\n", program_id);
408
 	puts(copyright);
408
 	puts(copyright);
409
 	puts("");
409
 	puts("");
545
 				break;
545
 				break;
546
 			case 'H':
546
 			case 'H':
547
 			case 'h':
547
 			case 'h':
548
-				show_usage(0);
548
+				show_usage();
549
 				exit(0);
549
 				exit(0);
550
 				break;
550
 				break;
551
 		}
551
 		}

+ 2
- 2
mptsd.c View File

134
 	keep_going = 0;
134
 	keep_going = 0;
135
 }
135
 }
136
 
136
 
137
-void init_signals() {
137
+void init_signals(void) {
138
 	signal(SIGCHLD, SIG_IGN);
138
 	signal(SIGCHLD, SIG_IGN);
139
 	signal(SIGPIPE, SIG_IGN);
139
 	signal(SIGPIPE, SIG_IGN);
140
 
140
 
157
 	daemonize(config->pidfile);
157
 	daemonize(config->pidfile);
158
 	web_server_start(config);
158
 	web_server_start(config);
159
 	log_init(config->logident, config->syslog_active, config->pidfile == NULL, config->loghost, config->logport);
159
 	log_init(config->logident, config->syslog_active, config->pidfile == NULL, config->loghost, config->logport);
160
-	init_signals(config);
160
+	init_signals();
161
 
161
 
162
 	LOGf("INIT  : %s %s (%s)\n" , server_sig, server_ver, config->ident);
162
 	LOGf("INIT  : %s %s (%s)\n" , server_sig, server_ver, config->ident);
163
 
163
 

+ 1
- 1
network.c View File

170
 				regcomp(&http_response, "^HTTP/1.[0-1] (([0-9]{3}) .*)", REG_EXTENDED);
170
 				regcomp(&http_response, "^HTTP/1.[0-1] (([0-9]{3}) .*)", REG_EXTENDED);
171
 				if (regexec(&http_response,buf,3,res,0) != REG_NOMATCH) {
171
 				if (regexec(&http_response,buf,3,res,0) != REG_NOMATCH) {
172
 					char codestr[4];
172
 					char codestr[4];
173
-					if ((unsigned int)res[1].rm_eo-res[1].rm_so < sizeof(xresponse)) {
173
+					if ((unsigned int)res[1].rm_eo-res[1].rm_so < (unsigned int)sizeof(xresponse)) {
174
 						strncpy(xresponse, &buf[res[1].rm_so], res[1].rm_eo-res[1].rm_so);
174
 						strncpy(xresponse, &buf[res[1].rm_so], res[1].rm_eo-res[1].rm_so);
175
 						xresponse[res[1].rm_eo-res[1].rm_so] = '\0';
175
 						xresponse[res[1].rm_eo-res[1].rm_so] = '\0';
176
 						chomp(xresponse);
176
 						chomp(xresponse);

+ 1
- 1
output_psi.c View File

96
 }
96
 }
97
 
97
 
98
 static void output_psi_init_tdt_tot(CONFIG *conf, OUTPUT *o) {
98
 static void output_psi_init_tdt_tot(CONFIG *conf, OUTPUT *o) {
99
-	conf = conf; // Silence warning
99
+	(void)conf; // Silence warning
100
 	o->pid_tdt_cont = 15;
100
 	o->pid_tdt_cont = 15;
101
 	o->tdt = ts_tdt_alloc_init(time(NULL));
101
 	o->tdt = ts_tdt_alloc_init(time(NULL));
102
 	o->tot = ts_tot_alloc_init(time(NULL));
102
 	o->tot = ts_tot_alloc_init(time(NULL));

Loading…
Cancel
Save