netdata/daemon: Eliminate a couple of warnings, plus tabs removal (#6222)
* netdata/daemon: Eliminate a couple of warnings, plus tabs removal on that file * netdata/daemon: fix indent
Paul Emm. Katsoulakis committed
Jun 5, 2019 at 19:12 UTC
7a44e650cb9b8db5bc89e3727ccda99f9b2fbe87
2 files changed
+20
-19
daemon/main.c
+16
-19
@@ -24,7 +24,7 @@ void netdata_cleanup_and_exit(int ret) {
24
error_log_limit_unlimited();
25
info("EXIT: netdata prepares to exit with code %d...", ret);
26
27
- send_statistics("EXIT", ret?"ERROR":"OK","-");
27
+ send_statistics("EXIT", ret?"ERROR":"OK","-");
28
29
// cleanup/save the database and exit
30
info("EXIT: cleaning up the database...");
@@ -50,7 +50,7 @@ void netdata_cleanup_and_exit(int ret) {
50
}
51
52
#ifdef ENABLE_HTTPS
53
- security_clean_openssl();
53
+ security_clean_openssl();
54
#endif
55
56
info("EXIT: all done - netdata is now exiting - bye bye...");
@@ -373,9 +373,9 @@ static void log_init(void) {
373
snprintfz(filename, FILENAME_MAX, "%s/access.log", netdata_configured_log_dir);
374
stdaccess_filename = config_get(CONFIG_SECTION_GLOBAL, "access log", filename);
375
376
- char deffacility[8];
377
- snprintfz(deffacility,7,"%s","daemon");
378
- facility_log = config_get(CONFIG_SECTION_GLOBAL, "facility log", deffacility);
376
+ char deffacility[8];
377
+ snprintfz(deffacility,7,"%s","daemon");
378
+ facility_log = config_get(CONFIG_SECTION_GLOBAL, "facility log", deffacility);
379
380
error_log_throttle_period = config_get_number(CONFIG_SECTION_GLOBAL, "errors flood protection period", error_log_throttle_period);
381
error_log_errors_per_period = (unsigned long)config_get_number(CONFIG_SECTION_GLOBAL, "errors to trigger flood protection", (long long int)error_log_errors_per_period);
@@ -742,20 +742,20 @@ void send_statistics( const char *action, const char *action_result, const char
742
if (likely(access(optout_file, R_OK) != 0)) {
743
as_script = mallocz(sizeof(char) * (strlen(netdata_configured_primary_plugins_dir) + strlen("anonymous-statistics.sh") + 2));
744
sprintf(as_script, "%s/%s", netdata_configured_primary_plugins_dir, "anonymous-statistics.sh");
745
- if (unlikely(access(as_script, R_OK) != 0)) {
746
- netdata_anonymous_statistics_enabled=0;
747
- info("Anonymous statistics script %s not found.",as_script);
748
- freez(as_script);
749
- } else {
750
- netdata_anonymous_statistics_enabled=1;
751
- }
752
- } else {
745
+ if (unlikely(access(as_script, R_OK) != 0)) {
746
+ netdata_anonymous_statistics_enabled=0;
747
+ info("Anonymous statistics script %s not found.",as_script);
748
+ freez(as_script);
749
+ } else {
750
+ netdata_anonymous_statistics_enabled=1;
751
+ }
752
+ } else {
753
netdata_anonymous_statistics_enabled = 0;
754
as_script = NULL;
755
}
756
freez(optout_file);
757
}
758
- if(!netdata_anonymous_statistics_enabled) return;
758
+ if(!netdata_anonymous_statistics_enabled) return;
759
if (!action) return;
760
if (!action_result) action_result="";
761
if (!action_data) action_data="";
@@ -899,12 +899,9 @@ int main(int argc, char **argv) {
899
return 0;
900
}
901
else if(strncmp(optarg, createdataset_string, strlen(createdataset_string)) == 0) {
902
- unsigned history_seconds;
903
-
902
optarg += strlen(createdataset_string);
905
- history_seconds = (unsigned )strtoull(optarg, NULL, 0);
906
-
903
#ifdef ENABLE_DBENGINE
904
+ unsigned history_seconds = (unsigned )strtoull(optarg, NULL, 0);
905
generate_dbengine_dataset(history_seconds);
906
#endif
907
return 0;
@@ -1191,7 +1188,7 @@ int main(int argc, char **argv) {
1188
// ------------------------------------------------------------------------
1189
// initialize rrd, registry, health, rrdpush, etc.
1190
1194
- netdata_anonymous_statistics_enabled=-1;
1191
+ netdata_anonymous_statistics_enabled=-1;
1192
struct rrdhost_system_info *system_info = calloc(1, sizeof(struct rrdhost_system_info));
1193
get_system_info(system_info);
1194
web/server/web_client.c
+4
@@ -821,8 +821,12 @@ static inline char *http_header_parse(struct web_client *w, char *s, int parse_u
821
typedef enum {
822
HTTP_VALIDATION_OK,
823
HTTP_VALIDATION_NOT_SUPPORTED,
824
+#ifdef ENABLE_HTTPS
825
HTTP_VALIDATION_INCOMPLETE,
826
HTTP_VALIDATION_REDIRECT
827
+#else
828
+ HTTP_VALIDATION_INCOMPLETE
829
+#endif
830
} HTTP_VALIDATION;
831
832
static inline HTTP_VALIDATION http_request_validate(struct web_client *w) {