When I run the following C code in RHEL 7.4:
errno = 0;
status = system("ls >> /tmp/test.txt");
sprintf(msg, "Value of errno: %d\n", errno);
sprintf(msg, "Status: %d ", status);
os_log_msg(msg);
I get return code of -1 and errno = 10 (No child processes). The /tmp/test.txt file is actually created, so it works, but the program sees a non-zero return code and exits.
The thing is that this command returned a 0 in HP-UX 11.11, but we migrated to RHEL 7.4 and now we get -1.
You need to sign in to view this answers