[hackers] [ubase] Print header after trying to open /proc/modules || sin

From: <git_AT_suckless.org>
Date: Fri, 04 Jul 2014 12:52:14 +0200

commit 55dd1076feffae9319cb9322157d2739f9cb0d23
Author: sin <sin_AT_2f30.org>
Date: Fri Jul 4 11:45:58 2014 +0100

    Print header after trying to open /proc/modules
    
    This fails on kernels compiled without module support or
    if procfs is not mounted.

diff --git a/lsmod.c b/lsmod.c
index 8ffc294..23e3390 100644
--- a/lsmod.c
+++ b/lsmod.c
_AT_@ -33,11 +33,12 @@ main(int argc, char *argv[])
         if (argc > 0)
                 usage();
 
- printf("%-23s Size Used by
", "Module");
-
         fp = fopen(modfile, "r");
         if (!fp)
                 eprintf("fopen %s:", modfile);
+
+ printf("%-23s Size Used by
", "Module");
+
         while (agetline(&buf, &bufsize, fp) != -1) {
                 parse_modline(buf, &name, &size, &refcount, &users);
                 if (!name || !size || !refcount || !users)
Received on Fri Jul 04 2014 - 12:52:14 CEST

This archive was generated by hypermail 2.3.0 : Fri Jul 04 2014 - 13:00:13 CEST