diff options
author | Karel Zak | 2015-07-29 14:59:56 +0200 |
---|---|---|
committer | Karel Zak | 2015-07-29 14:59:56 +0200 |
commit | dd8dac1914e7e51c0855c57c8f515608c0c8179f (patch) | |
tree | 9001ec0c50525a656ff2a251518194239b03553b /misc-utils/mcookie.c | |
parent | libsmartcols: make child-parent reference more robust [clang analyze] (diff) | |
download | kernel-qcow2-util-linux-dd8dac1914e7e51c0855c57c8f515608c0c8179f.tar.gz kernel-qcow2-util-linux-dd8dac1914e7e51c0855c57c8f515608c0c8179f.tar.xz kernel-qcow2-util-linux-dd8dac1914e7e51c0855c57c8f515608c0c8179f.zip |
mcookie: fix -f usage [clang analyze]
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'misc-utils/mcookie.c')
-rw-r--r-- | misc-utils/mcookie.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/misc-utils/mcookie.c b/misc-utils/mcookie.c index ee8ec38ba..f26d4d257 100644 --- a/misc-utils/mcookie.c +++ b/misc-utils/mcookie.c @@ -151,15 +151,14 @@ int main(int argc, char **argv) textdomain(PACKAGE); atexit(close_stdout); - if (2 < argc) - ctl.files = xmalloc(sizeof(char *) * argc); - while ((c = getopt_long(argc, argv, "f:m:vVh", longopts, NULL)) != -1) { switch (c) { case 'v': ctl.verbose = 1; break; case 'f': + if (!ctl.files) + ctl.files = xmalloc(sizeof(char *) * argc); ctl.files[ctl.nfiles++] = optarg; break; case 'm': |