diff options
author | Rob Landley <rob@landley.net> | 2006-03-06 19:31:39 +0000 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2006-03-06 19:31:39 +0000 |
commit | 1f5e25bf3eca768b8cee1c689ac154d8f51662f9 (patch) | |
tree | 515cdddb86c5244e7eb14f0a723e8d41d7541723 | |
parent | 2e9cf373a95b7b73b60e95372c1cc9192ce3ac3f (diff) | |
download | busybox-1f5e25bf3eca768b8cee1c689ac154d8f51662f9.tar.gz |
Walt Wimer noticed that mknod couldn't handle major or minor > 255. Now our
limit checking autodetects what the system supports (at compile time).
-rw-r--r-- | coreutils/mknod.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/coreutils/mknod.c b/coreutils/mknod.c index 7b2467b8f..b6e85272d 100644 --- a/coreutils/mknod.c +++ b/coreutils/mknod.c @@ -47,8 +47,10 @@ extern int mknod_main(int argc, char **argv) dev = 0; if ((*name != 'p') && ((argc -= 2) == 2)) { - dev = (bb_xgetularg10_bnd(argv[2], 0, 255) << 8) - + bb_xgetularg10_bnd(argv[3], 0, 255); + /* Autodetect what the system supports; thexe macros should + * optimize out to two constants. */ + dev = makedev(bb_xgetularg10_bnd(argv[2], 0, major(UINT_MAX)), + bb_xgetularg10_bnd(argv[3], 0, minor(UINT_MAX))); } if (argc == 2) { |