ubase

suckless linux base utils
git clone git://git.2f30.org/ubase
Log | Files | Refs | README | LICENSE

commit 55dd1076feffae9319cb9322157d2739f9cb0d23
parent 1ec0073bb813987a681f33225fdd5780902d99c8
Author: sin <sin@2f30.org>
Date:   Fri,  4 Jul 2014 11:45:58 +0100

Print header after trying to open /proc/modules

This fails on kernels compiled without module support or
if procfs is not mounted.

Diffstat:
Mlsmod.c | 5+++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lsmod.c b/lsmod.c @@ -33,11 +33,12 @@ main(int argc, char *argv[]) if (argc > 0) usage(); - printf("%-23s Size Used by\n", "Module"); - fp = fopen(modfile, "r"); if (!fp) eprintf("fopen %s:", modfile); + + printf("%-23s Size Used by\n", "Module"); + while (agetline(&buf, &bufsize, fp) != -1) { parse_modline(buf, &name, &size, &refcount, &users); if (!name || !size || !refcount || !users)