udev: turn off -Wformat-nonliteral for one safe case
authorLennart Poettering <lennart@poettering.net>
Thu, 18 May 2017 16:25:02 +0000 (18:25 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 19 May 2017 02:26:12 +0000 (22:26 -0400)
c20e6de897b2378bc3f936e1e265d2d2e2450a73 introduced a format string as
variable, but didn't turn off -Wformat-nonliteral warnings on it, thus
breaking the build. Let's fix that, by simply turning off the warning in
this case, as we know it's safe.

src/udev/udev-builtin-net_id.c

index f385fe9..46eb611 100644 (file)
@@ -389,8 +389,12 @@ static int names_platform(struct udev_device *dev, struct netnames *names, bool
          * eg. "/sys/devices/platform/HISI00C2:00");
          * The Vendor (3 or 4 char), followed by hexdecimal model number : instance id.
          */
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
         if (sscanf(syspath, pattern, vendor, &model, &instance, &ethid) != 4)
                 return -EINVAL;
+#pragma GCC diagnostic pop
 
         if (!in_charset(vendor, validchars))
                 return -ENOENT;