Exemplo n.º 1
0
BOOL file_unlock(int fd, int *plock_depth)
{
  BOOL ret=True;

  if(*plock_depth == 1)
    ret = do_file_lock(fd, 5, F_UNLCK);

  (*plock_depth)--;

  if(!ret)
    DEBUG(10,("file_unlock: unlocking file failed, error = %s.\n",
                 strerror(errno)));
  return ret;
}
Exemplo n.º 2
0
BOOL file_lock(int fd, int type, int secs, int *plock_depth)
{
	if (fd < 0)
		return False;

	(*plock_depth)++;

	if ((*plock_depth) == 0) {
		if (!do_file_lock(fd, secs, type)) {
			DEBUG(10,("file_lock: locking file failed, error = %s.\n", strerror(errno)));
			return False;
		}
	}

	return True;
}
Exemplo n.º 3
0
static bool pw_file_lock(int fd, int type, int secs, int *plock_depth)
{
	if (fd < 0) {
		return False;
	}

	if(*plock_depth == 0) {
		if (!do_file_lock(fd, secs, type)) {
			DEBUG(10,("pw_file_lock: locking file failed, error = %s.\n",
				strerror(errno)));
			return False;
		}
	}

	(*plock_depth)++;

	return True;
}
Exemplo n.º 4
0
static bool pw_file_unlock(int fd, int *plock_depth)
{
	bool ret=True;

	if (fd == 0 || *plock_depth == 0) {
		return True;
	}

	if(*plock_depth == 1) {
		ret = do_file_lock(fd, 5, F_UNLCK);
	}

	if (*plock_depth > 0) {
		(*plock_depth)--;
	}

	if(!ret) {
		DEBUG(10,("pw_file_unlock: unlocking file failed, error = %s.\n",
			strerror(errno)));
	}
	return ret;
}