]> arthur.barton.de Git - netdata.git/commitdiff
fix misleading error messages and command line arguments
authorValeriy <jazzvoid@gmail.com>
Tue, 29 Mar 2016 15:37:58 +0000 (18:37 +0300)
committerValeriy <jazzvoid@gmail.com>
Tue, 29 Mar 2016 15:37:58 +0000 (18:37 +0300)
src/appconfig.c
src/main.c
src/web_client.c

index 49eca90f0b00d96dbdca9041395851318b11b565..86c229372d8185046685cbc382682f143d9ce345 100755 (executable)
@@ -188,7 +188,7 @@ int load_config(char *filename, int overwrite_used)
        if(!filename) filename = CONFIG_DIR "/" CONFIG_FILENAME;
        FILE *fp = fopen(filename, "r");
        if(!fp) {
-               error("Cannot open file '%s'", CONFIG_DIR "/" CONFIG_FILENAME);
+               error("Cannot open file '%s'", filename);
                return 0;
        }
 
index a29757358aefd060fb9b47ee091776919051ff74..a2645bd26333bfd5565245e8dd5361a67540effa 100755 (executable)
@@ -215,7 +215,7 @@ int main(int argc, char **argv)
                else if(strcmp(argv[i], "-l")  == 0 && (i+1) < argc) { config_set("global", "history",      argv[i+1]); i++; }
                else if(strcmp(argv[i], "-t")  == 0 && (i+1) < argc) { config_set("global", "update every", argv[i+1]); i++; }
                else if(strcmp(argv[i], "-ch") == 0 && (i+1) < argc) { config_set("global", "host access prefix", argv[i+1]); i++; }
-               else if(strcmp(argv[i], "-nodeamon") == 0 || strcmp(argv[i], "-nd") == 0) dont_fork = 1;
+               else if(strcmp(argv[i], "-nodaemon") == 0 || strcmp(argv[i], "-nd") == 0) dont_fork = 1;
                else if(strcmp(argv[i], "--unittest")  == 0) {
                        rrd_update_every = 1;
                        if(run_all_mockup_tests()) exit(1);
@@ -225,7 +225,7 @@ int main(int argc, char **argv)
                }
                else {
                        fprintf(stderr, "Cannot understand option '%s'.\n", argv[i]);
-                       fprintf(stderr, "\nUSAGE: %s [-d] [-l LINES_TO_SAVE] [-u UPDATE_TIMER] [-p LISTEN_PORT] [-dl debug log file] [-df debug flags].\n\n", argv[0]);
+                       fprintf(stderr, "\nUSAGE: %s [-d] [-l LINES_TO_SAVE] [-u UPDATE_TIMER] [-p LISTEN_PORT] [-df debug flags].\n\n", argv[0]);
                        fprintf(stderr, "  -c CONFIG FILE the configuration file to load. Default: %s.\n", CONFIG_DIR "/" CONFIG_FILENAME);
                        fprintf(stderr, "  -l LINES_TO_SAVE can be from 5 to %d lines in JSON data. Default: %d.\n", RRD_HISTORY_ENTRIES_MAX, RRD_DEFAULT_HISTORY_ENTRIES);
                        fprintf(stderr, "  -t UPDATE_TIMER can be from 1 to %d seconds. Default: %d.\n", UPDATE_EVERY_MAX, UPDATE_EVERY);
index 1273335544f0243214b661eed0fe14ac85d512a2..ee7909226566d5a4993c2513a65cfefb4330b539 100755 (executable)
@@ -292,9 +292,9 @@ int mysendfile(struct web_client *w, char *filename)
                return 404;
        }
 
-       // check if the file is owned by us
+       // check if the file is owned by expected user
        if(stat.st_uid != web_files_uid()) {
-               error("%llu: File '%s' is owned by user %d (I run as user %d). Access Denied.", w->id, webfilename, stat.st_uid, getuid());
+               error("%llu: File '%s' is owned by user %d (expected user %d). Access Denied.", w->id, webfilename, stat.st_uid, web_files_uid());
                buffer_sprintf(w->response.data, "Access to file '%s' is not permitted.", filename);
                return 403;
        }