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-6bef3d1d2216234454875052220ca0f477a820b4.tar.gz
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)
argv += optind;
argc -= optind;
- if ((argc >= 2) && ((name = strchr(modes_chars, argv[1][0])) != NULL)) {
- mode |= modes_cubp[(int)(name[4])];
-
- dev = 0;
- if ((*name != 'p') && ((argc -= 2) == 2)) {
- /* Autodetect what the system supports; these macros should
- * optimize out to two constants. */
- dev = makedev(xatoul_range(argv[2], 0, major(UINT_MAX)),
- xatoul_range(argv[3], 0, minor(UINT_MAX)));
- }
+ if (argc >= 2) {
+ name = strchr(modes_chars, argv[1][0]);
+ if (name != NULL) {
+ mode |= modes_cubp[(int)(name[4])];
+
+ dev = 0;
+ if (*name != 'p') {
+ argc -= 2;
+ if (argc == 2) {
+ /* Autodetect what the system supports; these macros should
+ * optimize out to two constants. */
+ dev = makedev(xatoul_range(argv[2], 0, major(UINT_MAX)),
+ xatoul_range(argv[3], 0, minor(UINT_MAX)));
+ }
+ }
- if (argc == 2) {
- name = *argv;
- if (mknod(name, mode, dev) == 0) {
- return EXIT_SUCCESS;
+ if (argc == 2) {
+ name = *argv;
+ if (mknod(name, mode, dev) == 0) {
+ return EXIT_SUCCESS;
+ }
+ bb_simple_perror_msg_and_die(name);
}
- bb_simple_perror_msg_and_die(name);
}
}
bb_show_usage();