Fixed secert_chat_file read
This commit is contained in:
parent
c537196e5f
commit
5e9574ab10
6
loop.c
6
loop.c
@ -554,12 +554,12 @@ void read_secret_chat (int fd) {
|
|||||||
|
|
||||||
void read_secret_chat_file (void) {
|
void read_secret_chat_file (void) {
|
||||||
if (binlog_enabled) { return; }
|
if (binlog_enabled) { return; }
|
||||||
int secret_chat_fd = open (get_secret_chat_filename (), O_CREAT | O_RDWR, 0600);
|
int secret_chat_fd = open (get_secret_chat_filename (), O_RDWR, 0600);
|
||||||
if (secret_chat_fd < 0) { return; }
|
if (secret_chat_fd < 0) { return; }
|
||||||
//assert (secret_chat_fd >= 0);
|
//assert (secret_chat_fd >= 0);
|
||||||
int x;
|
int x;
|
||||||
assert (read (secret_chat_fd, &x, 4) == 4);
|
if (read (secret_chat_fd, &x, 4) < 4) { close (secret_chat_fd); return; }
|
||||||
assert (x == SECRET_CHAT_FILE_MAGIC);
|
if (x != SECRET_CHAT_FILE_MAGIC) { close (secret_chat_fd); return; }
|
||||||
assert (read (secret_chat_fd, &x, 4) == 4);
|
assert (read (secret_chat_fd, &x, 4) == 4);
|
||||||
assert (!x); // version
|
assert (!x); // version
|
||||||
assert (read (secret_chat_fd, &x, 4) == 4);
|
assert (read (secret_chat_fd, &x, 4) == 4);
|
||||||
|
Loading…
Reference in New Issue
Block a user