1
0
mirror of https://github.com/fumiama/CMoe-Counter.git synced 2024-11-27 23:20:49 +01:00

fix flock fseek

This commit is contained in:
源文雨 2023-06-09 12:47:00 +08:00
parent 09c44e87fb
commit 2187473132

11
cmoe.c
View File

@ -241,16 +241,7 @@ int main(int argc, char **argv) {
http_error(HTTP400, "Name Exist."); http_error(HTTP400, "Name Exist.");
return 7; return 7;
} }
flease(fp); fseek(fp, 0, SEEK_END);
fp = fopen(datfile, "ab+");
if (!fp) {
http_error(HTTP500, "Open File Error.");
return -6;
}
if(flock(fileno(fp), LOCK_EX)) {
http_error(HTTP500, "Lock File Error.");
return -7;
}
add_user(name, 0, fp); add_user(name, 0, fp);
flease(fp); flease(fp);
char* msg = "<P>Success.\r\n"; char* msg = "<P>Success.\r\n";