Module: kamailio
Branch: master
Commit: 5fd35624660cb46cd7894bfd43c7cb6259e451b3
URL:
https://github.com/kamailio/kamailio/commit/5fd35624660cb46cd7894bfd43c7cb6…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2021-06-15T09:17:50+02:00
core: main - catch common mistakes for the arguments
- print error and exit on 'kamailio start|stop|restart'
---
Modified: src/main.c
---
Diff:
https://github.com/kamailio/kamailio/commit/5fd35624660cb46cd7894bfd43c7cb6…
Patch:
https://github.com/kamailio/kamailio/commit/5fd35624660cb46cd7894bfd43c7cb6…
---
diff --git a/src/main.c b/src/main.c
index a391f57afb..950bcd895a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2024,6 +2024,25 @@ int main(int argc, char** argv)
{0, 0, 0, 0 }
};
+ if (argc > 1) {
+ /* checks for common wrong arguments */
+ if(strcasecmp(argv[1], "start")==0) {
+ fprintf(stderr, "error: 'start' is not a supported argument\n");
+ fprintf(stderr, "error: stopping " NAME " ...\n\n");
+ exit(-1);
+ }
+ if(strcasecmp(argv[1], "stop")==0) {
+ fprintf(stderr, "error: 'stop' is not a supported argument\n");
+ fprintf(stderr, "error: stopping " NAME " ...\n\n");
+ exit(-1);
+ }
+ if(strcasecmp(argv[1], "restart")==0) {
+ fprintf(stderr, "error: 'restart' is not a supported argument\n");
+ fprintf(stderr, "error: stopping " NAME " ...\n\n");
+ exit(-1);
+ }
+ }
+
/*init*/
time(&up_since);
creator_pid = getpid();