- use makedev to get device number, else it gives wrong major/minor numbers to device...
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Sun, 21 Jan 2007 11:20:01 +0000 (11:20 -0000)
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Sun, 21 Jan 2007 11:20:01 +0000 (11:20 -0000)
  Closes #919

miscutils/makedevs.c

index c25bdadc45210394228eb31ce4695de3957feef1..5602c22481aa5676ca64fc84cf6c2dc32c0cde47 100644 (file)
@@ -185,7 +185,7 @@ int makedevs_main(int argc, char **argv)
                                full_name_inc = xmalloc(strlen(full_name) + 4);
                                for (i = start; i < count; i++) {
                                        sprintf(full_name_inc, "%s%d", full_name, i);
-                                       rdev = (major << 8) + minor + (i * increment - start);
+                                       rdev = makedev(major, minor + (i * increment - start));
                                        if (mknod(full_name_inc, mode, rdev) == -1) {
                                                bb_perror_msg("line %d: cannot create node %s", linenum, full_name_inc);
                                                ret = EXIT_FAILURE;
@@ -201,7 +201,7 @@ int makedevs_main(int argc, char **argv)
                                }
                                free(full_name_inc);
                        } else {
-                               rdev = (major << 8) + minor;
+                               rdev = makedev(major, minor);
                                if (mknod(full_name, mode, rdev) == -1) {
                                        bb_perror_msg("line %d: cannot create node %s", linenum, full_name);
                                        ret = EXIT_FAILURE;