From 0676d450d0154814190040bdf28777991ee0d447 Mon Sep 17 00:00:00 2001 From: Joshua Kwan Date: Fri, 13 Feb 2004 22:30:59 +0000 Subject: [PATCH] CRITICAL: Do NOT call writefile() for a new user git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@229 db0b04b0-f4d1-0310-9a6d-de3e77497b0e --- dgamelaunch.c | 10 ++++++---- dgamelaunch.h | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/dgamelaunch.c b/dgamelaunch.c index 7493bd7..f3ef2bf 100644 --- a/dgamelaunch.c +++ b/dgamelaunch.c @@ -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) diff --git a/dgamelaunch.h b/dgamelaunch.h index ec61825..147a72e 100644 --- a/dgamelaunch.h +++ b/dgamelaunch.h @@ -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);