[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/2] Fix some minor issues.
From: |
Sergiu Ivanov |
Subject: |
[PATCH 1/2] Fix some minor issues. |
Date: |
Mon, 10 Aug 2009 23:11:41 +0300 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
>From 3f7c8c06d40b587c1d455ed69a31984d5995c33b Mon Sep 17 00:00:00 2001
From: Sergiu Ivanov <unlimitedscolobb@gmail.com>
Date: Tue, 4 Aug 2009 15:09:21 +0300
Subject: [PATCH] Fix some minor issues.
* eth-multiplexer/device_impl.c (ds_device_open): Check if
openstat flags are a subset of mode flags (not conversely).
* eth-multiplexer/vdev.c (add_vdev): Copy name only if it
is not NULL.
---
While the second fix is obvious, I cannot explain for sure why do we
need the first fix. What I can tell exactly is that without it the
.MASTER node does not work. I think I will have to investigate into
this issue further in the future.
---
eth-multiplexer/device_impl.c | 4 ++--
eth-multiplexer/vdev.c | 5 ++++-
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/eth-multiplexer/device_impl.c b/eth-multiplexer/device_impl.c
index f9c8fc3..4b2d37d 100644
--- a/eth-multiplexer/device_impl.c
+++ b/eth-multiplexer/device_impl.c
@@ -122,9 +122,9 @@ ds_device_open (mach_port_t master_port, mach_port_t
reply_port,
dev = (struct vether_device *) pi->po->np->nn->ln;
/* check the mode */
openstat = pi->po->openstat;
- if (mode & D_READ && !(openstat & O_READ))
+ if ((openstat & O_READ) && !(mode & D_READ))
right_mode = 0;
- if (mode & D_WRITE && !(openstat & O_WRITE))
+ if ((openstat & O_WRITE) && !(mode & D_WRITE))
right_mode = 0;
ports_port_deref (pi);
diff --git a/eth-multiplexer/vdev.c b/eth-multiplexer/vdev.c
index dac9802..6fb88d0 100644
--- a/eth-multiplexer/vdev.c
+++ b/eth-multiplexer/vdev.c
@@ -135,7 +135,10 @@ add_vdev (char *name, int size,
vdev->dev_port = ports_get_right (vdev);
ports_port_deref (vdev);
- strncpy (vdev->name, name, IFNAMSIZ);
+ if (name)
+ strncpy (vdev->name, name, IFNAMSIZ);
+ else
+ vdev->name[0] = 0;
vdev->if_header_size = ETH_HLEN;
vdev->if_mtu = ETH_MTU;
vdev->if_header_format = HDR_ETHERNET;
--
1.5.2.4