unification of netdev&netdev_dev in pltap&tunnel
[sliver-openvswitch.git] / lib / netlink-socket.c
index e6b10a1..fbb1724 100644 (file)
@@ -59,8 +59,7 @@ static void log_nlmsg(const char *function, int error,
 \f
 /* Netlink sockets. */
 
-struct nl_sock
-{
+struct nl_sock {
     int fd;
     uint32_t next_seq;
     uint32_t pid;
@@ -111,10 +110,7 @@ nl_sock_create(int protocol, struct nl_sock **sockp)
     }
 
     *sockp = NULL;
-    sock = malloc(sizeof *sock);
-    if (sock == NULL) {
-        return ENOMEM;
-    }
+    sock = xmalloc(sizeof *sock);
 
     sock->fd = socket(AF_NETLINK, SOCK_RAW, protocol);
     if (sock->fd < 0) {
@@ -130,7 +126,7 @@ nl_sock_create(int protocol, struct nl_sock **sockp)
                    &rcvbuf, sizeof rcvbuf)) {
         /* Only root can use SO_RCVBUFFORCE.  Everyone else gets EPERM.
          * Warn only if the failure is therefore unexpected. */
-        if (errno != EPERM || !getuid()) {
+        if (errno != EPERM) {
             VLOG_WARN_RL(&rl, "setting %d-byte socket receive buffer failed "
                          "(%s)", rcvbuf, strerror(errno));
         }