- if (type == 'b') {
- mode |= S_IFBLK;
- } else if ((type == 'c') || (type == 'u')){
- mode |= S_IFCHR;
- } else if ( type == 'p') {
- mode |= S_IFIFO;
- } else {
- dbg("unknown node type %c\n", type);
- return -1;
- }
-
- retval = mknod(filename,mode,makedev(major,minor));
+ switch (type) {
+ case 'b':
+ mode |= S_IFBLK;
+ break;
+ case 'c':
+ case 'u':
+ mode |= S_IFCHR;
+ break;
+ case 'p':
+ mode |= S_IFIFO;
+ break;
+ default:
+ dbg("unknown node type %c\n", type);
+ return -EINVAL;
+ }
+
+ dbg("mknod(%s, %#o, %u, %u)", filename, mode, major, minor);
+ retval = mknod(filename, mode, makedev(major, minor));
+ if (retval)
+ dbg("mknod(%s, %#o, %u, %u) failed with error '%s'",
+ filename, mode, major, minor, strerror(errno));