]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
MRTDump: check return value at writing dump into file mrtdump-core
authorPavel Tvrdik <pawel.tvrdik@gmail.com>
Mon, 2 May 2016 13:35:13 +0000 (15:35 +0200)
committerPavel Tvrdik <pawel.tvrdik@gmail.com>
Tue, 3 May 2016 07:25:37 +0000 (09:25 +0200)
sysdep/unix/log.c

index 3a5abc6b48800367fe10a802e6955e2dcccc6d4d..81500692163d19cd6ff0a1c3a4fde9d98071c368 100644 (file)
@@ -323,7 +323,7 @@ mrt_dump_message_proto(struct proto *p, u16 type, u16 subtype, byte *buf, u32 le
 }
 
 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 */
   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_u32(buf+8, len - MRT_HDR_LENGTH);
 
-  if (file_descriptor >= 0)
-    write(file_descriptor, buf, len);
+  if (fd >= 0)
+    if (write(fd, buf, len) == -1)
+      log(L_ERR, "Writing into MRTDump file failed: %m"); /* TODO: name of file */
 }