1
0
mirror of https://github.com/fumiama/CMoe-Counter.git synced 2024-12-18 07:25:52 +01:00

fix last user disappear

This commit is contained in:
源文雨 2023-06-28 13:29:31 +08:00
parent 9729d09da3
commit 5ad5065a44

6
cmoe.c
View File

@ -210,7 +210,7 @@ int main(int argc, char **argv) {
} }
fp = fdopen(fd, "rb+"); fp = fdopen(fd, "rb+");
return_count(fp, name, theme); return_count(fp, name, theme);
fclose(fp); fflush(fp); flock(fd, LOCK_UN); close(fd);
return 0; return 0;
} }
reg = get_arg(reg + 4); reg = get_arg(reg + 4);
@ -232,13 +232,13 @@ int main(int argc, char **argv) {
} }
fp = fdopen(fd, "rb+"); fp = fdopen(fd, "rb+");
if(name_exist(fp, name)) { if(name_exist(fp, name)) {
fclose(fp); fflush(fp); flock(fd, LOCK_UN); close(fd);
http_error(HTTP400, "Name Exist."); http_error(HTTP400, "Name Exist.");
return 7; return 7;
} }
fseek(fp, 0, SEEK_END); fseek(fp, 0, SEEK_END);
add_user(name, 0, fp); add_user(name, 0, fp);
fclose(fp); fflush(fp); flock(fd, LOCK_UN); close(fd);
char* msg = "<P>Success.\r\n"; char* msg = "<P>Success.\r\n";
if(headers(strlen(msg), "text/html")) { if(headers(strlen(msg), "text/html")) {
write(1, "\0\0\0\0", 4); write(1, "\0\0\0\0", 4);