]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
build: fix printf warnings for icc (-Wformat-security)
authorRuediger Meier <ruediger.meier@ga-group.nl>
Tue, 20 Jan 2015 14:49:21 +0000 (15:49 +0100)
committerRuediger Meier <ruediger.meier@ga-group.nl>
Wed, 21 Jan 2015 10:15:19 +0000 (11:15 +0100)
Intel compiler complains about printf style function calls with trivial
format string and no other arguments. Like this one:

../sys-utils/ipcrm.c(117): warning #2279: printf/scanf format not a string literal and no format arguments
                        err(EXIT_FAILURE, iskey ? _("key failed") : _("id failed"));

sys-utils/ipcrm.c
sys-utils/lscpu.c
sys-utils/rtcwake.c

index 4b59217a6dee2b5e62d71f7222c171e0a2d1de1c..0b40f1539b3fb928d7edd0db68cfc330ea218248 100644 (file)
@@ -114,7 +114,7 @@ static int remove_id(int type, int iskey, int id)
                        errmsg = iskey ? _("already removed key") : _("already removed id");
                        break;
                default:
-                       err(EXIT_FAILURE, iskey ? _("key failed") : _("id failed"));
+                       err(EXIT_FAILURE, "%s", iskey ? _("key failed") : _("id failed"));
                }
                warnx("%s (%d)", errmsg, id);
                return 1;
index 9b3adbcd589cf649762931cb49a32d92d432fccc..82a7dbe05cdab50d129ba6cd9993a6fe975d04fa 100644 (file)
@@ -1242,20 +1242,20 @@ get_cell_data(struct lscpu_desc *desc, int idx, int col,
                if (!desc->configured)
                        break;
                if (mod->mode == OUTPUT_PARSABLE)
-                       snprintf(buf, bufsz,
+                       snprintf(buf, bufsz, "%s",
                                 desc->configured[idx] ? _("Y") : _("N"));
                else
-                       snprintf(buf, bufsz,
+                       snprintf(buf, bufsz, "%s",
                                 desc->configured[idx] ? _("yes") : _("no"));
                break;
        case COL_ONLINE:
                if (!desc->online)
                        break;
                if (mod->mode == OUTPUT_PARSABLE)
-                       snprintf(buf, bufsz,
+                       snprintf(buf, bufsz, "%s",
                                 is_cpu_online(desc, cpu) ? _("Y") : _("N"));
                else
-                       snprintf(buf, bufsz,
+                       snprintf(buf, bufsz, "%s",
                                 is_cpu_online(desc, cpu) ? _("yes") : _("no"));
                break;
        case COL_MAXMHZ:
index 35ca7e893831b1c056e70a555a9c3c452258153f..bf99a5b8fa9c0e4251ecf35b01cede4d584cad3d 100644 (file)
@@ -492,7 +492,7 @@ int main(int argc, char **argv)
                }
        }
        if (verbose)
-               printf(clock_mode == CM_UTC ? _("Using UTC time.\n") :
+               printf("%s", clock_mode == CM_UTC ? _("Using UTC time.\n") :
                                _("Using local time.\n"));
 
        if (!alarm && !seconds && strcmp(suspend,"disable") &&