I have a C++ application running on an embedded Linux that builds and calls cURL commands to copy files to an FTP server.
std::string cmd = "curl --connect-timeout 10 --ftp-create-dirs "
+ localPath + filename + " "
+ ftpPath + filename + " "
+ userAuth;
int retVal = system(cmd.c_str());
Depending on the variables to build the command, this returns unexpected error codes. For example, when I try to copy a file that doesn't exist, retVal
is 6656 instead of the expected 26 ("local file not found"), and when I turn off the server, retVal
is 1792 instead of the expected 7 ("could not connect to server").
Looking at the values, I am pretty sure that this has something to do with endianness, but I would like to understand the root cause. The device has an ARMv7 processor and uses little endian format.