gen_init_cpio: Ignore fsync() returning EINVAL on pipes

The reproducer:
echo | ./usr/gen_init_cpio /dev/stdin > /dev/null

fsync() on a pipe fd returns -EINVAL, which makes gen_init_cpio fail.
Ignore -EINVAL from fsync().

Fixes: ae18b94099b0 ("gen_init_cpio: support -o <output_file> parameter")
Cc: David Disseldorp <ddiss@suse.de>
Cc: Nicolas Schier <nsc@kernel.org>
Signed-off-by: Dmitry Safonov <dima@arista.com>
Reviewed-by: David Disseldorp <ddiss@suse.de>
Link: https://patch.msgid.link/20251007-gen_init_cpio-pipe-v2-1-b098ab94b58a@arista.com
Signed-off-by: Nathan Chancellor <nathan@kernel.org>

authored by Dmitry Safonov and committed by Nathan Chancellor 38492c57 7ded7d37

+4 -1
+4 -1
usr/gen_init_cpio.c
··· 112 push_pad(padlen(offset, 512)) < 0) 113 return -1; 114 115 - return fsync(outfd); 116 } 117 118 static int cpio_mkslink(const char *name, const char *target,
··· 112 push_pad(padlen(offset, 512)) < 0) 113 return -1; 114 115 + if (fsync(outfd) < 0 && errno != EINVAL) 116 + return -1; 117 + 118 + return 0; 119 } 120 121 static int cpio_mkslink(const char *name, const char *target,