0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-10-18 09:58:43 +00:00

MRTDump: check return value at writing dump into file

This commit is contained in:
Pavel Tvrdik 2016-05-02 15:35:13 +02:00
parent 71f0d9e0ff
commit fdce72a0f3

View File

@ -323,7 +323,7 @@ mrt_dump_message_proto(struct proto *p, u16 type, u16 subtype, byte *buf, u32 le
} }
void void
mrt_dump_message(int file_descriptor, u16 type, u16 subtype, byte *buf, u32 len) mrt_dump_message(int fd, u16 type, u16 subtype, byte *buf, u32 len)
{ {
/* Prepare header */ /* Prepare header */
put_u32(buf+0, now_real); put_u32(buf+0, now_real);
@ -331,6 +331,7 @@ mrt_dump_message(int file_descriptor, u16 type, u16 subtype, byte *buf, u32 len)
put_u16(buf+6, subtype); put_u16(buf+6, subtype);
put_u32(buf+8, len - MRT_HDR_LENGTH); put_u32(buf+8, len - MRT_HDR_LENGTH);
if (file_descriptor >= 0) if (fd >= 0)
write(file_descriptor, buf, len); if (write(fd, buf, len) == -1)
log(L_ERR, "Writing into MRTDump file failed: %m"); /* TODO: name of file */
} }