File klibc-2.0.4-kinit-nozlib.patch of Package klibc

diff -Nurp klibc-2.0.4/usr/kinit/do_mounts.h klibc-2.0.4-kinit-nozlib/usr/kinit/do_mounts.h
--- klibc-2.0.4/usr/kinit/do_mounts.h	2014-07-26 03:15:06.000000000 +0300
+++ klibc-2.0.4-kinit-nozlib/usr/kinit/do_mounts.h	2014-09-22 02:25:33.000000000 +0300
@@ -43,7 +43,9 @@ static inline dev_t bstat(const char *na
 	return st.st_rdev;
 }
 
+#ifdef CONFIG_KLIBC_ZLIB
 int load_ramdisk_compressed(const char *devpath, FILE * wfd,
 			    off_t ramdisk_start);
+#endif
 
 #endif				/* DO_MOUNTS_H */
diff -Nurp klibc-2.0.4/usr/kinit/initrd.c klibc-2.0.4-kinit-nozlib/usr/kinit/initrd.c
--- klibc-2.0.4/usr/kinit/initrd.c	2014-07-26 03:15:06.000000000 +0300
+++ klibc-2.0.4-kinit-nozlib/usr/kinit/initrd.c	2014-09-22 02:30:08.000000000 +0300
@@ -61,11 +61,15 @@ static int rd_copy_image(const char *pat
 
 	if (xpread(ffd, gzip_magic, 2, 0) == 2 &&
 	    gzip_magic[0] == 037 && gzip_magic[1] == 0213) {
+#ifdef CONFIG_KLIBC_ZLIB
 		FILE *wfd = fopen("/dev/ram0", "w");
 		if (!wfd)
 			goto barf;
 		rv = load_ramdisk_compressed(path, wfd, 0);
 		fclose(wfd);
+#else
+		fputs("kinit: gzipped image type unsupported\n", stderr);
+#endif
 	} else {
 		int dfd = open("/dev/ram0", O_WRONLY);
 		if (dfd < 0)
diff -Nurp klibc-2.0.4/usr/kinit/ramdisk_load.c klibc-2.0.4-kinit-nozlib/usr/kinit/ramdisk_load.c
--- klibc-2.0.4/usr/kinit/ramdisk_load.c	2014-07-26 03:15:06.000000000 +0300
+++ klibc-2.0.4-kinit-nozlib/usr/kinit/ramdisk_load.c	2014-09-22 02:24:45.000000000 +0300
@@ -46,6 +46,7 @@ static int change_disk(const char *devpa
 	return open(devpath, O_RDONLY);
 }
 
+#ifdef CONFIG_KLIBC_ZLIB
 /* Also used in initrd.c */
 int load_ramdisk_compressed(const char *devpath, FILE * wfd,
 			    off_t ramdisk_start)
@@ -133,6 +134,7 @@ err2:
 err1:
 	return -1;
 }
+#endif
 
 static int
 load_ramdisk_raw(const char *devpath, FILE * wfd, off_t ramdisk_start,
@@ -253,9 +255,14 @@ int ramdisk_load(int argc, char *argv[])
 
 	close(rfd);
 
-	if (is_gzip)
+	if (is_gzip) {
+#ifdef CONFIG_KLIBC_ZLIB
 		err = load_ramdisk_compressed("/dev/rddev", wfd, ramdisk_start);
-	else
+#else
+		fputs("Failure loading ramdisk: gzip type unsupported", stderr);
+		err = 1;
+#endif
+	} else
 		err = load_ramdisk_raw("/dev/rddev", wfd,
 				       ramdisk_start, fssize);
openSUSE Build Service is sponsored by