safelock.c
/* Create and lock a new unique safelock */
Create and lock a new unique safelock
Create and lock a new unique safelock
int safelock_lock_unique_file(safelock_t *lock, const char *file_prefix,
                              mode_t mode, int data)
{
    int err;
    err = safelock_open_unique(lock, file_prefix, mode);
    if (err)
        return err;
    err = safelock_lock(*lock, SAFELOCK_LOCK_TRY, data);
    if (err) {
        safelock_remove(*lock);
        safelock_close(lock);
    }
    return err;
}
int safelock_lock_unique_file ( safelock_t * lock , const char * file_prefix , mode_t mode , int data ) { int err ; err = safelock_open_unique ( lock , file_prefix , mode ) ; if ( err ) return err ; err = safelock_lock ( * lock , SAFELOCK_LOCK_TRY , data ) ; if ( err ) { safelock_remove ( * lock ) ; safelock_close ( lock ) ; } return err ; }
Create and lock a new unique safelock
Create and lock a new unique safelock