TunDevice_PT.cc: Properly report tun device write errors
This commit is contained in:
parent
5224db9da9
commit
65e28822be
|
@ -2,6 +2,7 @@
|
|||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -103,10 +104,9 @@ TunDevice__PT_PROVIDER::~TunDevice__PT_PROVIDER()
|
|||
}
|
||||
|
||||
/* setting a port parameter via config file */
|
||||
void TunDevice__PT_PROVIDER::set_parameter(const char *parameter_name,
|
||||
const char *parameter_value)
|
||||
void TunDevice__PT_PROVIDER::set_parameter(const char *parameter_name, const char *parameter_value)
|
||||
{
|
||||
printf("%s(%s, %s)\n", __func__, parameter_name, parameter_value);
|
||||
//printf("%s(%s, %s)\n", __func__, parameter_name, parameter_value);
|
||||
if (!strcmp(parameter_name, "device_name"))
|
||||
tun_data.dev = strdup(parameter_value);
|
||||
if (!strcmp(parameter_name, "debugging"))
|
||||
|
@ -175,6 +175,10 @@ void TunDevice__PT_PROVIDER::outgoing_send(const TunDevice__Types::Tun__send& se
|
|||
|
||||
rc = write(tun_data.fd, (const char*)(const unsigned char*)send_par.msg(),
|
||||
send_par.msg().lengthof());
|
||||
if (rc < 0) {
|
||||
TTCN_error("writing to tun");
|
||||
return;
|
||||
}
|
||||
log("Nr of bytes sent = %d", rc);
|
||||
log("leaving %s", __func__);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue