Changeset 154


Ignore:
Timestamp:
Dec 7, 2005, 12:58:15 PM (13 years ago)
Author:
andree
Message:

Evaluate errno to find out whether an external command succeeded or not
in function run_program_and_log_to_screen(). This ensures amongst other
things that we terminate if mindi fails rather than happily continuing
and throwing an incomprehensible error later down the track because no
floppy images exist.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.05/mondo/mondo/common/libmondo-fork.c

    r128 r154  
    473473    }
    474474#endif
    475     paranoid_pclose(fin);
    476     retval += res;
     475    /* Evaluate the status returned by pclose to get the exit code of the called program. */
     476    errno = 0;
     477    res = pclose(fin);
     478    /* Log actual pclose errors. */
     479    if (errno) log_msg(5, "pclose err: %d", errno);
     480    /* Check if we have a valid status. If we do, extract the called program's exit code. */
     481    /* If we don't, highlight this fact by returning -1. */
     482    if (WIFEXITED(res)) {
     483        retval = WEXITSTATUS(res);
     484    } else {
     485        retval = -1;
     486    }
    477487    close_evalcall_form();
    478488    unlink(lockfile);
Note: See TracChangeset for help on using the changeset viewer.