s/fileno\(stdin\)/STDIN_FILENO/g
s/fileno\(stdout\)/STDOUT_FILENO/g
diff --git a/libbb/print_file.c b/libbb/print_file.c
index bd7108d..8f85cb4 100644
--- a/libbb/print_file.c
+++ b/libbb/print_file.c
@@ -28,7 +28,7 @@
 	bb_xfflush_stdout();
 	/* Note: Do not use STDOUT_FILENO here, as this is a lib routine
 	 *       and the calling code may have reassigned stdout. */
-	if (bb_copyfd_eof(fileno(file), fileno(stdout)) == -1) {
+	if (bb_copyfd_eof(fileno(file), STDOUT_FILENO) == -1) {
 		/* bb_copyfd outputs any needed messages, so just die. */
 		exit(bb_default_error_retval);
 	}