]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
config: check if opening /proc/cmdline succeeded
authorLucas De Marchi <lucas.demarchi@profusion.mobi>
Fri, 6 Jan 2012 21:22:41 +0000 (19:22 -0200)
committerLucas De Marchi <lucas.demarchi@profusion.mobi>
Fri, 6 Jan 2012 21:22:41 +0000 (19:22 -0200)
libkmod/libkmod-config.c

index f43724728950b13c9174ea5b5227ffe1872c4c42..e55e230924c0d441a7d5350dc37b179f04185548 100644 (file)
@@ -444,6 +444,12 @@ static int kmod_config_parse_kcmdline(struct kmod_config *config)
        char *p, *modname,  *param = NULL, *value = NULL;
 
        fd = open("/proc/cmdline", O_RDONLY|O_CLOEXEC);
+       if (fd < 0) {
+               err = -errno;
+               DBG(config->ctx, "could not open '/proc/cmdline' for reading: %m\n");
+               return err;
+       }
+
        err = read_str_safe(fd, buf, sizeof(buf));
        close(fd);
        if (err < 0) {