* setup.c: create citadel.config with mode 0600
authorNathan Bryant <loanshark@uncensored.citadel.org>
Thu, 3 Dec 1998 05:56:57 +0000 (05:56 +0000)
committerNathan Bryant <loanshark@uncensored.citadel.org>
Thu, 3 Dec 1998 05:56:57 +0000 (05:56 +0000)
citadel/ChangeLog
citadel/setup.c

index cfc01e9a3bdddbc8da28d93b10577e2d64a42fb1..ef01a8494531eeee2d6f6cff6830fd84235555e4 100644 (file)
@@ -1,3 +1,6 @@
+1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
+       * setup.c: create citadel.config with mode 0600
+
 Wed Dec  2 20:37:05 EST 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
        * msgbase.c: modified AddMessageToRoom() and all functions that call it
          to use a more reliable/accurate method to set quickroom.QRhighest
index dae34b0a3e9bff236a8876cd8bce9dd0cacd42f9..81e61cf6d96caaa2a766a19eb7686b93fedd8699 100644 (file)
@@ -657,8 +657,14 @@ case 4:
  */
 void write_config_to_disk(void) {
        FILE *fp;
+       int fd;
 
-       fp=fopen("citadel.config","wb");
+       if ((fd = creat("citadel.config", S_IRUSR | S_IWUSR)) == -1) {
+               display_error("setup: cannot open citadel.config");
+               cleanup(1);
+               }
+
+       fp=fdopen(fd,"wb");
        if (fp==NULL) {
                display_error("setup: cannot open citadel.config");
                cleanup(1);
@@ -772,7 +778,13 @@ int main(int argc, char *argv[]) {
         * completely new copy.  (Neat, eh?)
         */
 
-       fp=fopen("citadel.config","ab");
+       if ((a = open("citadel.config", O_WRONLY | O_CREAT | O_APPEND,
+                     S_IRUSR | S_IWUSR)) == -1) {
+               display_error("setup: cannot append citadel.config");
+               cleanup(errno);
+               }
+
+       fp=fdopen(a,"ab");
        if (fp==NULL) {
                display_error("setup: cannot append citadel.config");
                cleanup(errno);