X-Git-Url: https://tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Fconf.c;h=82bc52163b11881588e7010d6921c70f2bc79ba9;hp=1c250d7bc3c76f4846d6de58351936a2cf48b6a5;hb=985d19caf20058db3c764f0f6fbeafa8bcc59fcc;hpb=d178b583df9fe2bf3ebb3a7377203efc5c46df32 diff --git a/src/conf.c b/src/conf.c index 1c250d7b..82bc5216 100644 --- a/src/conf.c +++ b/src/conf.c @@ -303,7 +303,7 @@ bool read_config_file(avl_tree_t *config_tree, const char *fname) { } for(;;) { - line = readline(fp, buffer, sizeof buffer); + line = readline(fp, buffer, sizeof(buffer)); if(!line) { if(feof(fp)) @@ -375,14 +375,14 @@ bool read_server_config(void) { read_config_options(config_tree, NULL); - snprintf(fname, sizeof fname, "%s/tinc.conf", confbase); + snprintf(fname, sizeof(fname), "%s/tinc.conf", confbase); errno = 0; x = read_config_file(config_tree, fname); // We will try to read the conf files in the "conf.d" dir if (x) { char dname[PATH_MAX]; - snprintf(dname, sizeof dname, "%s/conf.d", confbase); + snprintf(dname, sizeof(dname), "%s/conf.d", confbase); DIR *dir = opendir (dname); // If we can find this dir if (dir) { @@ -392,7 +392,7 @@ bool read_server_config(void) { size_t l = strlen(ep->d_name); // And we try to read the ones that end with ".conf" if (l > 5 && !strcmp(".conf", & ep->d_name[ l - 5 ])) { - snprintf(fname, sizeof fname, "%s/%s", dname, ep->d_name); + snprintf(fname, sizeof(fname), "%s/%s", dname, ep->d_name); x = read_config_file(config_tree, fname); } } @@ -413,7 +413,7 @@ bool read_connection_config(connection_t *c) { read_config_options(c->config_tree, c->name); - snprintf(fname, sizeof fname, "%s/hosts/%s", confbase, c->name); + snprintf(fname, sizeof(fname), "%s/hosts/%s", confbase, c->name); x = read_config_file(c->config_tree, fname); return x; @@ -429,11 +429,11 @@ static void disable_old_keys(const char *filename) { if(!r) return; - snprintf(tmpfile, sizeof tmpfile, "%s.tmp", filename); + snprintf(tmpfile, sizeof(tmpfile), "%s.tmp", filename); w = fopen(tmpfile, "w"); - while(fgets(buf, sizeof buf, r)) { + while(fgets(buf, sizeof(buf), r)) { if(!strncmp(buf, "-----BEGIN RSA", 14)) { buf[11] = 'O'; buf[12] = 'L'; @@ -465,7 +465,7 @@ static void disable_old_keys(const char *filename) { #ifdef HAVE_MINGW // We cannot atomically replace files on Windows. char bakfile[PATH_MAX] = ""; - snprintf(bakfile, sizeof bakfile, "%s.bak", filename); + snprintf(bakfile, sizeof(bakfile), "%s.bak", filename); if(rename(filename, bakfile) || rename(tmpfile, filename)) { rename(bakfile, filename); #else @@ -502,7 +502,7 @@ FILE *ask_and_open(const char *filename, const char *what) { what, filename); fflush(stdout); - fn = readline(stdin, line, sizeof line); + fn = readline(stdin, line, sizeof(line)); if(!fn) { fprintf(stderr, "Error while reading stdin: %s\n", @@ -521,8 +521,8 @@ FILE *ask_and_open(const char *filename, const char *what) { if(fn[0] != '/') { #endif /* The directory is a relative path or a filename. */ - getcwd(directory, sizeof directory); - snprintf(abspath, sizeof abspath, "%s/%s", directory, fn); + getcwd(directory, sizeof(directory)); + snprintf(abspath, sizeof(abspath), "%s/%s", directory, fn); fn = abspath; }