- single KERNEL_VERSION(a,b,c) macro in platform.h
[oweals/busybox.git] / modutils / modprobe.c
index 32a37ce1711226742284cf82a5d2c8dd93f070a6..59c06ee1ed7bfffd4ca782a8297525b70b08ce4f 100644 (file)
@@ -283,7 +283,7 @@ static void include_conf ( struct dep_t **first, struct dep_t **current, char *b
                if ( p )
                        *p = 0;
 
-               l = bb_strlen ( buffer );
+               l = strlen ( buffer );
 
                while ( l && isspace ( buffer [l-1] )) {
                        buffer [l-1] = 0;
@@ -364,8 +364,8 @@ static void include_conf ( struct dep_t **first, struct dep_t **current, char *b
 }
 
 /*
- * This function builds a list of dependency rules from /lib/modules/`uname -r\modules.dep.
- * It then fills every modules and aliases with their  default options, found by parsing
+ * This function builds a list of dependency rules from /lib/modules/`uname -r`\modules.dep.
+ * It then fills every modules and aliases with their default options, found by parsing
  * modprobe.conf (or modules.conf, or conf.modules).
  */
 static struct dep_t *build_dep ( void )
@@ -388,18 +388,18 @@ static struct dep_t *build_dep ( void )
        }
 
        filename = bb_xasprintf("/lib/modules/%s/modules.dep", un.release );
-
-       if (( fd = open ( filename, O_RDONLY )) < 0 ) {
-
+       fd = open ( filename, O_RDONLY );
+       if (ENABLE_FEATURE_CLEAN_UP)
+               free(filename);
+       if (fd < 0) {
                /* Ok, that didn't work.  Fall back to looking in /lib/modules */
                if (( fd = open ( "/lib/modules/modules.dep", O_RDONLY )) < 0 ) {
                        return 0;
                }
        }
-       free(filename);
 
        while ( reads ( fd, buffer, sizeof( buffer ))) {
-               int l = bb_strlen ( buffer );
+               int l = strlen ( buffer );
                char *p = 0;
 
                while ( l > 0 && isspace ( buffer [l-1] )) {
@@ -553,16 +553,16 @@ static struct dep_t *build_dep ( void )
        include_conf (&first, &current, buffer, sizeof(buffer), fd);
        close(fd);
 
-       filename = bb_xasprintf("/lib/modules/%s/modules.alias", un.release );
-
-       if (( fd = open ( filename, O_RDONLY )) < 0 ) {
-
+       filename = bb_xasprintf("/lib/modules/%s/modules.alias", un.release);
+       fd = open ( filename, O_RDONLY );
+       if (ENABLE_FEATURE_CLEAN_UP)
+               free(filename);
+       if (fd < 0) {
                /* Ok, that didn't work.  Fall back to looking in /lib/modules */
                if (( fd = open ( "/lib/modules/modules.alias", O_RDONLY )) < 0 ) {
                        return first;
                }
        }
-       free(filename);
 
        include_conf (&first, &current, buffer, sizeof(buffer), fd);
        close(fd);