fix dnamlen, they missed the e, so we need to follow.
[citadel.git] / citadel / config.c
index 25b7f66e27026650f3dd678eec28f07132b9ec04..3d6527f38db4a8e50970d706cc8124d0d05727d7 100644 (file)
@@ -228,14 +228,16 @@ void put_config(void)
        FILE *cfp;
        int blocks_written = 0;
 
        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) {
                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);
                        chown(file_citadel_config, CTDLUID, (-1));
                        chmod(file_citadel_config, 0600);
+                       fclose(cfp);
                        return;
                }
                        return;
                }
+               fclose(cfp);
        }
        syslog(LOG_EMERG, "%s: %s", file_citadel_config, strerror(errno));
 }
        }
        syslog(LOG_EMERG, "%s: %s", file_citadel_config, strerror(errno));
 }