QNX RTOS v4 Knowledge Base
QNX RTOS v4 Knowledge Base
Title |
'cp' returns 0 when it fails to copy a file to itself |
Ref. No. |
QNX.000009670 |
Category(ies) |
Utilities, Filesystem, Configuration |
Issue |
In QNX4 'cp' returns 0 when it fails to copy a file to itself (with error msg on stdout). Should it not return something else? If so, has this been fixed?
|
Solution |
'cp' is doing what it is supposed to do. No error has occured, but POSIX allows that a diagnostic message to stderr be written in this case. The exit status will only be non-zero if an error occurs. Another way to think about it, if the command 'cp a b' is entered, then after the 'cp' command is done the desired result is to have 'a' the same as 'b' - therefore, the copy has been successful, so no error is generated. But, because this might not be what you actually meant to do, POSIX allows the utility to inform the user. |
|