• L
    util: change virFile*Pid functions to return < 0 on failure · d6354c16
    Laine Stump 提交于
    Although most functions in libvirt return 0 on success and < 0 on
    failure, there are a few functions lingering around that return errno
    (a positive value) on failure, and sometimes code calling those
    functions incorrectly assumes the <0 standard. I noticed one of these
    the other day when auditing networkStartDhcpDaemon after Guido Gunther
    found a place where success was improperly returned on failure (that
    patch has been acked and is pending a push). The problem was that it
    expected the return value from virFileReadPid to be < 0 on failure,
    but it was actually positive (it was also neglected to set the return
    code in this case, similar to the bug found by Guido).
    
    This all led to the fact that *all* of the virFile*Pid functions in
    util.c are returning errno on failure. This patch remedies that
    problem by changing them all to return -errno on failure, and makes
    any necessary changes to callers of the functions. (In the meantime, I
    also properly set the return code on failure of virFileReadPid in
    networkStartDhcpDaemon).
    d6354c16
util.c 63.1 KB