libkmod: Handle long lines in /proc/modules
authorMichal Marek <mmarek@suse.cz>
Fri, 17 Jun 2016 14:04:15 +0000 (16:04 +0200)
committerLucas De Marchi <lucas.demarchi@intel.com>
Tue, 21 Jun 2016 21:00:20 +0000 (18:00 -0300)
commit2206d7f763a1c9cf88f77d0ab19e410d17749361
treeac98a3fbca522a67781230e833c82293f177eeaa
parentd46136bb59c46609ee8050636f0681f2831d2225
libkmod: Handle long lines in /proc/modules

kmod_module_new_from_loaded() calls fgets with a 4k buffer. When a
module such as usbcore is used by too many modules, the rest of the line
is considered a beginning of another lines and we eventually get errors
like these from lsmod:

libkmod: kmod_module_get_holders: could not open '/sys/module/100,/holders': No such file or directory

together with bogus entries in the output. In kmod_module_get_size, the
problem does not affect functionality, but the line numbers in error
messages will be wrong.

Signed-off-by: Michal Marek <mmarek@suse.com>
libkmod/libkmod-module.c