[PATCH] Fix sprintf modifiers in usr/gen_init_cpio.c for cygwin
authorAndrew Morton <akpm@osdl.org>
Wed, 18 Feb 2004 12:59:24 +0000 (04:59 -0800)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Wed, 18 Feb 2004 12:59:24 +0000 (04:59 -0800)
commit499104b6a0075edf7e1fe2ba5b6123f335f26897
tree1a284e7b45cb1f6caa6f8f4eedf7baec179ce3b5
parentaa81900ec1ee8cc5f3ae56db52ad9b59a90cfe4a
[PATCH] Fix sprintf modifiers in usr/gen_init_cpio.c for cygwin

From: Pragnesh Sampat <pragnesh.sampat@timesys.com>

The file initramfs_data.cpio is slightly different when generated on
cygwin, compared to linux, which causes the kernel to panic with the
message "no cpio magic" (See Documentation/early-userspace/README).

The problem in cpio generation is due to the difference in sprintf
modifiers on cygwin.  The code uses "%08ZX" for strlen of a device node.
printf man pages discourages "Z" and has 'z' instead.  Both of these are
not available on cygwin sprintf (at least some versions of cygwin).  The
net result of all of this is that the generated file literally contains
"ZX" and then the strlen after that and messes up that 110 offset etc.  The
file is 516 bytes long on the system that I tested and on linux it is 512
bytes.

The fix below just uses "%08X" for that field.
usr/gen_init_cpio.c