#define XERR "flock"
#include "flock.ih"

    // by 

void Flock::setFilename(string const &filename, mode_t mode)
{
    if (d_fd != -1)             // remove a current lock
        unlock();

    reset();
    d_filename = filename;

    if (d_fd = open(filename.c_str(), O_CREAT, mode); d_fd == -1)
        throw Exception{} << "No fd for " << filename << ": " << 
                             FBB::errnodescr;

}
