File klibc-2.0.4-mknod.patch of Package klibc

diff -Ndurp klibc-2.0.4/usr/utils/mknod.c klibc-2.0.4-mknod/usr/utils/mknod.c
--- klibc-2.0.4/usr/utils/mknod.c	2014-07-09 18:21:02.000000000 +0300
+++ klibc-2.0.4-mknod/usr/utils/mknod.c	2016-08-10 21:55:47.492986610 +0300
@@ -5,23 +5,16 @@
 
 char *progname;
 
-static __noreturn usage(void)
-{
-	fprintf(stderr, "Usage: %s [-m mode] name {b|c|p} major minor\n",
-			progname);
-	exit(1);
-}
-
 int main(int argc, char *argv[])
 {
-	char *name, *type, typec, *endp;
+	char *name, *type, *endp;
 	unsigned int major_num, minor_num;
 	mode_t mode, mode_set = 0;
 	dev_t dev;
 
 	progname = *argv++;
 	if (argc == 1)
-		usage();
+		goto usage;
 
 	if (argv[0][0] == '-' && argv[0][1] == 'm' && !argv[0][2]) {
 		mode_set = strtoul(argv[1], &endp, 8);
@@ -30,15 +23,14 @@ int main(int argc, char *argv[])
 
 	name = *argv++;
 	if (!name)
-		usage();
+		goto usage;
 
 	type = *argv++;
 	if (!type || !type[0] || type[1])
-		usage();
-	typec = type[0];
+		goto usage;
 
 	mode = 0;
-	switch (typec) {
+	switch (*type) {
 	case 'c':
 		mode = S_IFCHR;
 		break;
@@ -49,36 +41,39 @@ int main(int argc, char *argv[])
 		mode = S_IFIFO;
 		break;
 	default:
-		usage();
+		goto usage;
 	}
 
-	if (mode == S_IFIFO) {
+	if (mode == S_IFIFO)
 		dev = 0;
-	} else {
+	else {
 		if (!argv[0] || !argv[1])
-			usage();
+			goto usage;
 
 		major_num = strtol(*argv++, &endp, 0);
 		if (*endp != '\0')
-			usage();
+			goto usage;
 		minor_num = strtol(*argv++, &endp, 0);
 		if (*endp != '\0')
-			usage();
+			goto usage;
 		dev = makedev(major_num, minor_num);
 	}
 
-	if (*argv)
-		usage();
+	if (*argv) {
+usage:
+		fprintf(stderr, "Usage: %s [-m mode] name {b|c|p} major minor\n", progname);
+		return 1;
+	}
 
-	if (mknod(name, mode|0666, dev) == -1) {
+	if (mknod(name, mode | 0666, dev) == -1) {
 		perror("mknod");
-		exit(1);
+		return 1;
 	}
 
 	if (mode_set && chmod(name, mode_set)) {
 		perror("chmod");
-		exit(1);
+		return 1;
 	}
 
-	exit(0);
+	return 0;
 }
openSUSE Build Service is sponsored by