[haiku-commits] haiku: hrev52342 - in src: add-ons/kernel/network/devices/ethernet system/libroot/posix/unistd system/libroot/posix/sys system/libroot/os system/libroot/posix

  • From: waddlesplash <waddlesplash@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 13 Sep 2018 16:42:47 -0400 (EDT)

hrev52342 adds 2 changesets to branch 'master'
old head: 110ba6da3a2a01ba9c302929320cc48d4bf5e03a
new head: 62a788f3239921bf6f6b4ceaa6e53f9253f69715
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=62a788f32399+%5E110ba6da3a2a

----------------------------------------------------------------------------

4d5c5a7e6675: libroot: More RETURN_AND_SET_ERRNO cleanup.
  
  No functional change intended.

62a788f32399: ethernet: Fix some more incorrect return value handlings of 
ioctl().

                              [ Augustin Cavalier <waddlesplash@xxxxxxxxx> ]

----------------------------------------------------------------------------

7 files changed, 12 insertions(+), 52 deletions(-)
src/add-ons/kernel/network/devices/ethernet/ethernet.cpp |  8 ++++++--
src/system/libroot/os/fs_info.c                          | 11 +----------
src/system/libroot/posix/sys/rlimit.c                    |  9 +--------
src/system/libroot/posix/sys/uio.c                       |  9 +--------
src/system/libroot/posix/unistd/process.c                |  9 +--------
src/system/libroot/posix/unistd/truncate.c               |  9 +--------
src/system/libroot/posix/utime.c                         |  9 +--------

############################################################################

Commit:      4d5c5a7e66752b774e2a90219d13ef4ae08d1521
URL:         https://git.haiku-os.org/haiku/commit/?id=4d5c5a7e6675
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Thu Sep 13 20:05:22 2018 UTC

libroot: More RETURN_AND_SET_ERRNO cleanup.

No functional change intended.

----------------------------------------------------------------------------

diff --git a/src/system/libroot/os/fs_info.c b/src/system/libroot/os/fs_info.c
index d9bb11d158..f9adec53b9 100644
--- a/src/system/libroot/os/fs_info.c
+++ b/src/system/libroot/os/fs_info.c
@@ -12,16 +12,7 @@
 
 #include <errno_private.h>
 #include <syscalls.h>
-
-
-#define RETURN_AND_SET_ERRNO(status) \
-       { \
-               if (status < 0) { \
-                       __set_errno(status); \
-                       return -1; \
-               } \
-               return status; \
-       }
+#include <syscall_utils.h>
 
 
 dev_t
diff --git a/src/system/libroot/posix/sys/rlimit.c 
b/src/system/libroot/posix/sys/rlimit.c
index a5a94dc05f..f02a0f2a67 100644
--- a/src/system/libroot/posix/sys/rlimit.c
+++ b/src/system/libroot/posix/sys/rlimit.c
@@ -9,14 +9,7 @@
 #include <errno.h>
 
 #include <errno_private.h>
-
-
-#define RETURN_AND_SET_ERRNO(err) \
-       if (err < 0) { \
-               __set_errno(err); \
-               return -1; \
-       } \
-       return err;
+#include <syscall_utils.h>
 
 
 int
diff --git a/src/system/libroot/posix/sys/uio.c 
b/src/system/libroot/posix/sys/uio.c
index 3f71b4c286..380b33be88 100644
--- a/src/system/libroot/posix/sys/uio.c
+++ b/src/system/libroot/posix/sys/uio.c
@@ -10,14 +10,7 @@
 #include <errno.h>
 
 #include <errno_private.h>
-
-
-#define RETURN_AND_SET_ERRNO(err) \
-       if (err < 0) { \
-               __set_errno(err); \
-               return -1; \
-       } \
-       return err;
+#include <syscall_utils.h>
 
 
 ssize_t
diff --git a/src/system/libroot/posix/unistd/process.c 
b/src/system/libroot/posix/unistd/process.c
index 5714c6ec3b..bc0d928dc6 100644
--- a/src/system/libroot/posix/unistd/process.c
+++ b/src/system/libroot/posix/unistd/process.c
@@ -12,14 +12,7 @@
 #include <errno.h>
 
 #include <errno_private.h>
-
-
-#define RETURN_AND_SET_ERRNO(err) \
-       if (err < 0) { \
-               __set_errno(err); \
-               return -1; \
-       } \
-       return err;
+#include <syscall_utils.h>
 
 
 extern thread_id __main_thread_id;
diff --git a/src/system/libroot/posix/unistd/truncate.c 
b/src/system/libroot/posix/unistd/truncate.c
index cd5dd152b0..3ef0bb087d 100644
--- a/src/system/libroot/posix/unistd/truncate.c
+++ b/src/system/libroot/posix/unistd/truncate.c
@@ -12,14 +12,7 @@
 #include <errno.h>
 
 #include <errno_private.h>
-
-
-#define RETURN_AND_SET_ERRNO(err) \
-       if (err < 0) { \
-               __set_errno(err); \
-               return -1; \
-       } \
-       return err;
+#include <syscall_utils.h>
 
 
 int
diff --git a/src/system/libroot/posix/utime.c b/src/system/libroot/posix/utime.c
index 5fa8d26402..1fdfd1725d 100644
--- a/src/system/libroot/posix/utime.c
+++ b/src/system/libroot/posix/utime.c
@@ -13,14 +13,7 @@
 
 #include <errno_private.h>
 #include <syscalls.h>
-
-
-#define RETURN_AND_SET_ERRNO(err) \
-       if (err < 0) { \
-               __set_errno(err); \
-               return -1; \
-       } \
-       return err;
+#include <syscall_utils.h>
 
 
 int

############################################################################

Revision:    hrev52342
Commit:      62a788f3239921bf6f6b4ceaa6e53f9253f69715
URL:         https://git.haiku-os.org/haiku/commit/?id=62a788f32399
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Thu Sep 13 20:14:36 2018 UTC

ethernet: Fix some more incorrect return value handlings of ioctl().

----------------------------------------------------------------------------

diff --git a/src/add-ons/kernel/network/devices/ethernet/ethernet.cpp 
b/src/add-ons/kernel/network/devices/ethernet/ethernet.cpp
index 147a59877c..110b9ac2c9 100644
--- a/src/add-ons/kernel/network/devices/ethernet/ethernet.cpp
+++ b/src/add-ons/kernel/network/devices/ethernet/ethernet.cpp
@@ -400,7 +400,9 @@ ethernet_add_multicast(struct net_device *_device, const 
sockaddr *_address)
        if (address->sdl_type != IFT_ETHER)
                return B_BAD_VALUE;
 
-       return ioctl(device->fd, ETHER_ADDMULTI, LLADDR(address), 6);
+       if (ioctl(device->fd, ETHER_ADDMULTI, LLADDR(address), 6) < 0)
+               return errno;
+       return B_OK;
 }
 
 
@@ -416,7 +418,9 @@ ethernet_remove_multicast(struct net_device *_device, const 
sockaddr *_address)
        if (address->sdl_type != IFT_ETHER)
                return B_BAD_VALUE;
 
-       return ioctl(device->fd, ETHER_REMMULTI, LLADDR(address), 6);
+       if (ioctl(device->fd, ETHER_REMMULTI, LLADDR(address), 6) < 0)
+               return errno;
+       return B_OK;
 }
 
 


Other related posts:

  • » [haiku-commits] haiku: hrev52342 - in src: add-ons/kernel/network/devices/ethernet system/libroot/posix/unistd system/libroot/posix/sys system/libroot/os system/libroot/posix - waddlesplash