diff options
author | Josh Triplett <josh@joshtriplett.org> | 2016-01-10 07:10:25 -0800 |
---|---|---|
committer | Lucas De Marchi <lucas.demarchi@intel.com> | 2016-01-11 10:25:31 -0200 |
commit | 4c30a11d5fa84ebfdd3a8f05fa4ba1c16c074f43 (patch) | |
tree | b92d0a1e4acedcbc71ce024676cac55b520f4a89 | |
parent | d64b286a9ae59293e43f20f23ca5e63bc7a1638e (diff) | |
download | kmod-4c30a11d5fa84ebfdd3a8f05fa4ba1c16c074f43.tar.gz |
depmod: Don't insert comment in modules.devname if otherwise empty
This allows tools to detect the file as empty, such as via systemd's
ConditionFileNotEmpty.
-rw-r--r-- | tools/depmod.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/tools/depmod.c b/tools/depmod.c index a585d47..6e9bb4d 100644 --- a/tools/depmod.c +++ b/tools/depmod.c @@ -1999,8 +1999,7 @@ static int output_builtin_bin(struct depmod *depmod, FILE *out) static int output_devname(struct depmod *depmod, FILE *out) { size_t i; - - fputs("# Device nodes to trigger on-demand module loading.\n", out); + bool empty = true; for (i = 0; i < depmod->modules.count; i++) { const struct mod *mod = depmod->modules.array[i]; @@ -2036,10 +2035,15 @@ static int output_devname(struct depmod *depmod, FILE *out) } if (devname != NULL) { - if (type != '\0') + if (type != '\0') { + if (empty) { + fputs("# Device nodes to trigger on-demand module loading.\n", + out); + empty = false; + } fprintf(out, "%s %s %c%u:%u\n", mod->modname, devname, type, major, minor); - else + } else ERR("Module '%s' has devname (%s) but " "lacks major and minor information. " "Ignoring.\n", mod->modname, devname); |