summaryrefslogtreecommitdiff
path: root/gatchat
diff options
context:
space:
mode:
Diffstat (limited to 'gatchat')
-rw-r--r--gatchat/gathdlc.c15
-rw-r--r--gatchat/ppp_net.c2
2 files changed, 17 insertions, 0 deletions
diff --git a/gatchat/gathdlc.c b/gatchat/gathdlc.c
index 1d5f239c..130e3cce 100644
--- a/gatchat/gathdlc.c
+++ b/gatchat/gathdlc.c
@@ -95,13 +95,28 @@ static void hdlc_record(int fd, gboolean in, guint8 *data, guint16 length)
ts = htonl(now.tv_sec & 0xffffffff);
id = 0x07;
+
err = write(fd, &id, 1);
+ if (err < 0)
+ return;
+
err = write(fd, &ts, 4);
+ if (err < 0)
+ return;
id = in ? 0x02 : 0x01;
+
err = write(fd, &id, 1);
+ if (err < 0)
+ return;
+
err = write(fd, &len, 2);
+ if (err < 0)
+ return;
+
err = write(fd, data, length);
+ if (err < 0)
+ return;
}
void g_at_hdlc_set_recording(GAtHDLC *hdlc, const char *filename)
diff --git a/gatchat/ppp_net.c b/gatchat/ppp_net.c
index 6facc6d7..7ce7bc81 100644
--- a/gatchat/ppp_net.c
+++ b/gatchat/ppp_net.c
@@ -87,6 +87,8 @@ void ppp_net_process_packet(struct ppp_net *net, const guint8 *packet)
len = get_host_short(&packet[2]);
status = g_io_channel_write_chars(net->channel, (gchar *) packet,
len, &bytes_written, NULL);
+ if (status != G_IO_STATUS_NORMAL)
+ return;
}
/*