chiark / gitweb /
util: rework rm_rf() logic
[elogind.git] / src / shared / socket-label.c
index 7a03ac0c51aa2bda1bb68d347c5e1fe96516ed44..dfb8a1a43137a9554bfcf5f58519bc959e871bed 100644 (file)
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <assert.h>
 #include <string.h>
 #include <unistd.h>
 #include <errno.h>
-#include <stdlib.h>
-#include <arpa/inet.h>
-#include <stdio.h>
-#include <net/if.h>
-#include <sys/types.h>
 #include <sys/stat.h>
 #include <stddef.h>
-#include <sys/ioctl.h>
 
 #include "macro.h"
 #include "util.h"
 #include "mkdir.h"
-#include "socket-util.h"
 #include "missing.h"
-#include "label.h"
+#include "selinux-util.h"
+#include "socket-util.h"
 
 int socket_address_listen(
                 const SocketAddress *a,
@@ -93,13 +86,13 @@ int socket_address_listen(
                 if (free_bind) {
                         one = 1;
                         if (setsockopt(fd, IPPROTO_IP, IP_FREEBIND, &one, sizeof(one)) < 0)
-                                log_warning("IP_FREEBIND failed: %m");
+                                log_warning_errno(errno, "IP_FREEBIND failed: %m");
                 }
 
                 if (transparent) {
                         one = 1;
                         if (setsockopt(fd, IPPROTO_IP, IP_TRANSPARENT, &one, sizeof(one)) < 0)
-                                log_warning("IP_TRANSPARENT failed: %m");
+                                log_warning_errno(errno, "IP_TRANSPARENT failed: %m");
                 }
         }
 
@@ -161,10 +154,8 @@ int make_socket_fd(int log_level, const char* address, int flags) {
                 _cleanup_free_ char *p = NULL;
 
                 r = socket_address_print(&a, &p);
-                if (r < 0) {
-                        log_error_errno(r, "socket_address_print(): %m");
-                        return r;
-                }
+                if (r < 0)
+                        return log_error_errno(r, "socket_address_print(): %m");
 
                 if (fd < 0)
                         log_error_errno(fd, "Failed to listen on %s: %m", p);