aboutsummaryrefslogtreecommitdiff
path: root/coreutils/mknod.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-11-06 03:05:54 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-11-06 03:05:54 +0000
commit6bef3d1d2216234454875052220ca0f477a820b4 (patch)
tree717060345370b781d3d1cde7ab4dd29304a066e8 /coreutils/mknod.c
parent1bec1b980e3cf5ad604fb0c2038a3ab83d9ab5f5 (diff)
downloadbusybox-w32-6bef3d1d2216234454875052220ca0f477a820b4.tar.gz
busybox-w32-6bef3d1d2216234454875052220ca0f477a820b4.tar.bz2
busybox-w32-6bef3d1d2216234454875052220ca0f477a820b4.zip
fbset: fix buglet where we were using wrong pointer
readahead: stop using stdio.h *: style fixes
Diffstat (limited to 'coreutils/mknod.c')
-rw-r--r--coreutils/mknod.c36
1 files changed, 21 insertions, 15 deletions
diff --git a/coreutils/mknod.c b/coreutils/mknod.c
index ee539e387..55f531033 100644
--- a/coreutils/mknod.c
+++ b/coreutils/mknod.c
@@ -28,23 +28,29 @@ int mknod_main(int argc, char **argv)
28 argv += optind; 28 argv += optind;
29 argc -= optind; 29 argc -= optind;
30 30
31 if ((argc >= 2) && ((name = strchr(modes_chars, argv[1][0])) != NULL)) { 31 if (argc >= 2) {
32 mode |= modes_cubp[(int)(name[4])]; 32 name = strchr(modes_chars, argv[1][0]);
33 33 if (name != NULL) {
34 dev = 0; 34 mode |= modes_cubp[(int)(name[4])];
35 if ((*name != 'p') && ((argc -= 2) == 2)) { 35
36 /* Autodetect what the system supports; these macros should 36 dev = 0;
37 * optimize out to two constants. */ 37 if (*name != 'p') {
38 dev = makedev(xatoul_range(argv[2], 0, major(UINT_MAX)), 38 argc -= 2;
39 xatoul_range(argv[3], 0, minor(UINT_MAX))); 39 if (argc == 2) {
40 } 40 /* Autodetect what the system supports; these macros should
41 * optimize out to two constants. */
42 dev = makedev(xatoul_range(argv[2], 0, major(UINT_MAX)),
43 xatoul_range(argv[3], 0, minor(UINT_MAX)));
44 }
45 }
41 46
42 if (argc == 2) { 47 if (argc == 2) {
43 name = *argv; 48 name = *argv;
44 if (mknod(name, mode, dev) == 0) { 49 if (mknod(name, mode, dev) == 0) {
45 return EXIT_SUCCESS; 50 return EXIT_SUCCESS;
51 }
52 bb_simple_perror_msg_and_die(name);
46 } 53 }
47 bb_simple_perror_msg_and_die(name);
48 } 54 }
49 } 55 }
50 bb_show_usage(); 56 bb_show_usage();