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; }
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; }
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; }
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; }