diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2008-03-30 17:12:47 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2008-03-30 17:12:47 +0800 |
commit | 0fbac25aa77ca39a1f38dc8086c021f69e8245fc (patch) | |
tree | 8f30024b8b5bf60fbfceaf2266f4af3b03d2f517 | |
parent | 1b56c760ca157354d878443949232307f08b2010 (diff) | |
download | pttbbs-0fbac25aa77ca39a1f38dc8086c021f69e8245fc.tar pttbbs-0fbac25aa77ca39a1f38dc8086c021f69e8245fc.tar.gz pttbbs-0fbac25aa77ca39a1f38dc8086c021f69e8245fc.tar.bz2 pttbbs-0fbac25aa77ca39a1f38dc8086c021f69e8245fc.tar.lz pttbbs-0fbac25aa77ca39a1f38dc8086c021f69e8245fc.tar.xz pttbbs-0fbac25aa77ca39a1f38dc8086c021f69e8245fc.tar.zst pttbbs-0fbac25aa77ca39a1f38dc8086c021f69e8245fc.zip |
- fix: new_register failed to create new regform
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4045 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | mbbsd/register.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/mbbsd/register.c b/mbbsd/register.c index 45141af9..f2c8db31 100644 --- a/mbbsd/register.c +++ b/mbbsd/register.c @@ -964,18 +964,23 @@ u_register(void) i = file_find_record(FN_REQLIST, cuser.userid); #else fn = fopen(fn_register, "rt"); - while (fn && fgets(genbuf, STRLEN, fn)) { + if (fn) { + int found = 0; char *ptr; - if (strncmp(genbuf, "uid: ", 5) != 0) - continue; - i++; - if ((ptr = strchr(genbuf, '\n'))) - *ptr = '\0'; - if(strcmp(genbuf + 5, cuser.userid) == 0) + while (fgets(genbuf, sizeof(genbuf), fn)) { + if (strncmp(genbuf, "uid: ", 5) != 0) + continue; + i++; + if ((ptr = strchr(genbuf, '\n'))) + *ptr = '\0'; + if(strcmp(genbuf + 5, cuser.userid) 1= 0) + continue; + // found + found = 1; break; - genbuf[0] = 0; + } + if (!found) i = 0; // drop index if not found. } - if (!genbuf[0]) i = 0; // drop index if not found. if (fn) fclose(fn); #endif // !USE_REGFORM2 |