chiark / gitweb /
Fix a few more typos
[elogind.git] / src / core / kmod-setup.c
index 9709d364f8bfd7ee6bc6d2d4c624a010ed872325..2f3f60883092d2ebb234a7f373f4318505353b77 100644 (file)
 
 #include "macro.h"
 #include "execute.h"
-
+#include "capability.h"
 #include "kmod-setup.h"
 
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wformat-nonliteral"
-
 static void systemd_kmod_log(
                 void *data,
                 int priority,
@@ -42,11 +39,11 @@ static void systemd_kmod_log(
                 va_list args) {
 
         /* library logging is enabled at debug only */
+        DISABLE_WARNING_FORMAT_NONLITERAL;
         log_metav(LOG_DEBUG, file, line, fn, format, args);
+        REENABLE_WARNING;
 }
 
-#pragma GCC diagnostic pop
-
 static bool cmdline_check_kdbus(void) {
         _cleanup_free_ char *line = NULL;
 
@@ -57,6 +54,7 @@ static bool cmdline_check_kdbus(void) {
 }
 
 int kmod_setup(void) {
+
         static const struct {
                 const char *module;
                 const char *path;
@@ -79,6 +77,9 @@ int kmod_setup(void) {
         unsigned int i;
         int r;
 
+        if (have_effective_cap(CAP_SYS_MODULE) == 0)
+                return 0;
+
         for (i = 0; i < ELEMENTSOF(kmod_table); i++) {
                 struct kmod_module *mod;