]> code.citadel.org Git - citadel.git/blobdiff - citadel/config.c
Merge branch 'master' of ssh://git.citadel.org/appl/gitroot/citadel
[citadel.git] / citadel / config.c
index 25b7f66e27026650f3dd678eec28f07132b9ec04..28084aa1e6186fc2812a4e60fc3dcf8115823318 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Read and write the citadel.config file
  *
- * Copyright (c) 1987-2012 by the citadel.org team
+ * Copyright (c) 1987-2014 by the citadel.org team
  *
  * This program is open source software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 3.
@@ -91,6 +91,8 @@ void brand_new_installation_set_defaults(void) {
        config.c_managesieve_port = 2020;
        config.c_xmpp_c2s_port = 5222;
        config.c_xmpp_s2s_port = 5269;
+       config.c_nntp_port = 119;
+       config.c_nntps_port = 563;
 }
 
 void setcfglen(void)
@@ -228,14 +230,16 @@ void put_config(void)
        FILE *cfp;
        int blocks_written = 0;
 
-       if ((cfp = fopen(file_citadel_config, "w")) != NULL) {
+       cfp = fopen(file_citadel_config, "w");
+       if (cfp != NULL) {
                blocks_written = fwrite((char *) &config, sizeof(struct config), 1, cfp);
                if (blocks_written == 1) {
-                       fclose(cfp);
                        chown(file_citadel_config, CTDLUID, (-1));
                        chmod(file_citadel_config, 0600);
+                       fclose(cfp);
                        return;
                }
+               fclose(cfp);
        }
        syslog(LOG_EMERG, "%s: %s", file_citadel_config, strerror(errno));
 }