dist: linux-border_router: reduce scope
This commit is contained in:
parent
bc0a05f19d
commit
136a6b0d35
3
dist/tools/linux-border_router/multiplex.c
vendored
3
dist/tools/linux-border_router/multiplex.c
vendored
@ -60,12 +60,11 @@ uint8_t serial_read_byte()
|
|||||||
int readpacket(uint8_t *packet_buf, size_t size)
|
int readpacket(uint8_t *packet_buf, size_t size)
|
||||||
{
|
{
|
||||||
uint8_t *line_buf_ptr = packet_buf;
|
uint8_t *line_buf_ptr = packet_buf;
|
||||||
uint8_t byte = END + 1;
|
|
||||||
uint8_t esc = 0;
|
uint8_t esc = 0;
|
||||||
uint8_t translate = 1;
|
uint8_t translate = 1;
|
||||||
|
|
||||||
while ((line_buf_ptr - packet_buf) < size - 1) {
|
while ((line_buf_ptr - packet_buf) < size - 1) {
|
||||||
byte = serial_read_byte();
|
uint8_t byte = serial_read_byte();
|
||||||
|
|
||||||
if (translate && byte == END) {
|
if (translate && byte == END) {
|
||||||
break;
|
break;
|
||||||
|
|||||||
3
dist/tools/linux-border_router/serial.c
vendored
3
dist/tools/linux-border_router/serial.c
vendored
@ -111,7 +111,7 @@ static void report_open_error(const char *filename, int err)
|
|||||||
struct passwd *p;
|
struct passwd *p;
|
||||||
struct group *g;
|
struct group *g;
|
||||||
mode_t perm;
|
mode_t perm;
|
||||||
int r, perm_ok = 0;
|
int r;
|
||||||
|
|
||||||
printf("\r\n");
|
printf("\r\n");
|
||||||
printf("Unable to open \"%s\"\r\n", filename);
|
printf("Unable to open \"%s\"\r\n", filename);
|
||||||
@ -198,6 +198,7 @@ static void report_open_error(const char *filename, int err)
|
|||||||
else {
|
else {
|
||||||
printf("%s is not read/write for everybody, so\r\n", filename);
|
printf("%s is not read/write for everybody, so\r\n", filename);
|
||||||
printf(" you must match either user or group permission\r\n");
|
printf(" you must match either user or group permission\r\n");
|
||||||
|
int perm_ok = 0;
|
||||||
|
|
||||||
if ((perm & S_IRUSR) && (perm & S_IWUSR)) {
|
if ((perm & S_IRUSR) && (perm & S_IWUSR)) {
|
||||||
printf("%s has read/write permission for user %s\r\n",
|
printf("%s has read/write permission for user %s\r\n",
|
||||||
|
|||||||
@ -101,10 +101,9 @@ int tun_to_serial_packet(uint8_t *serial_packet, uint8_t *tun_packet, size_t pac
|
|||||||
void *tun_reader_f(void *args)
|
void *tun_reader_f(void *args)
|
||||||
{
|
{
|
||||||
unsigned char data[BUFFER_SIZE];
|
unsigned char data[BUFFER_SIZE];
|
||||||
size_t bytes;
|
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
bytes = read(tun_fd, (void *)data, BUFFER_SIZE);
|
size_t bytes = read(tun_fd, (void *)data, BUFFER_SIZE);
|
||||||
|
|
||||||
if (bytes > 0) {
|
if (bytes > 0) {
|
||||||
bytes = tun_to_serial_packet(tun_in_buf, (uint8_t *)data, bytes);
|
bytes = tun_to_serial_packet(tun_in_buf, (uint8_t *)data, bytes);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user