When copying a file from a Yaffs file system to a host-mounted file system, Yafut tries to also copy file permissions. Calling fchmod() is expected to always work for standard output and regular files, but not necessarily for other objects that can be represented by a file descriptor (e.g. the /dev/null character device). Since Yafut's primary role is copying file contents and any fchmod() errors cause the program's exit code to become non-zero, only call fchmod() when it is expected to succeed and report success without calling fchmod() otherwise.
When copying a file from a Yaffs file system to a host-mounted file system, Yafut tries to also copy file permissions. Calling fchmod() is expected to always work for standard output and regular files, but not necessarily for other objects that can be represented by a file descriptor (e.g. the /dev/null character device). Since Yafut's primary role is copying file contents and any fchmod() errors cause the program's exit code to become non-zero, only call fchmod() when it is expected to succeed and report success without calling fchmod() otherwise.