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:
parent
09c44e87fb
commit
2187473132
11
cmoe.c
11
cmoe.c
@ -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";
|
||||||
|
Loading…
Reference in New Issue
Block a user