[libvirt] [PATCH 4/4] util: print errno in virObjectLockableNew

Jincheng Miao jmiao at redhat.com
Wed Jul 16 02:47:04 UTC 2014

----- Original Message -----
> I'm not sure errno is set when using our virMutexInit().  Most of the
> code uses virReportError instead, I suggest using that.  This should

Actually, the implement of virMutexInit() already set errno when failure:

int virMutexInit(virMutexPtr m)
    int ret;
    pthread_mutexattr_t attr;
    pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_NORMAL);
    ret = pthread_mutex_init(&m->lock, &attr);
    if (ret != 0) {
        errno = ret;
        return -1;
    return 0;

> be changed everywhere in the code.  Rough idea of the places could be

I think it worthy of adding after all virMutexInit, I will include it in
my V2 patchset.

> gotten by the following command:
> git grep -nA5 virMutexInit | grep SystemError
> but as I said, only rough idea :)
> Martin

More information about the libvir-list mailing list