]> skyeroc.xyz Git - dgamelaunch/commitdiff
CRITICAL: Do NOT call writefile() for a new user
authorJoshua Kwan <joshk@triplehelix.org>
Fri, 13 Feb 2004 22:30:59 +0000 (22:30 +0000)
committerJoshua Kwan <joshk@triplehelix.org>
Fri, 13 Feb 2004 22:30:59 +0000 (22:30 +0000)
git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@229 db0b04b0-f4d1-0310-9a6d-de3e77497b0e

dgamelaunch.c
dgamelaunch.h

index 7493bd769bd5cb0549e3f4f6fa3512b3a2423d62..f3ef2bf4ec0a44ac5800993076b82ab765d8cc27 100644 (file)
@@ -615,7 +615,7 @@ change_email ()
 }
 
 int
-changepw ()
+changepw (int dowrite)
 {
   char buf[21];
   int error = 2;
@@ -670,7 +670,9 @@ changepw ()
 
   free(me->password);
   me->password = strdup (crypt (buf, buf));
-  writefile (0);
+
+  if (dowrite == 1)
+    writefile (0);
 
   return 1;
 }
@@ -993,7 +995,7 @@ newuser ()
 
   clear ();
 
-  if (!changepw ())                  /* Calling changepw instead to prompt twice. */
+  if (!changepw (0))                  /* Calling changepw instead to prompt twice. */
   {
     free(me->username);
     free(me);
@@ -1506,7 +1508,7 @@ menuloop (void)
         {
         case 'c':
           if (loggedin)
-            changepw ();
+            changepw (1);
           break;
        case 'e':
          if (loggedin)
index ec618259f1088f7bd8118b6033145e91cf99d72e..147a72ec9620de852ed117b24cc93b9d397ed782 100644 (file)
@@ -73,7 +73,7 @@ extern void drawbanner(unsigned int start_line, unsigned int howmany);
 extern struct dg_game **populate_games(int *l);
 extern void inprogressmenu(void);
 extern void change_email(void);
-extern int changepw(void);
+extern int changepw(int dowrite);
 extern void domailuser(char *username);
 extern void drawmenu(void);
 extern void freefile(void);