From 313d8ef27df81118b57f3d214db75be25e38b612 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 10 Nov 1998 18:14:16 +0000 Subject: util functions split into relevant modules, first pass. (This used to be commit d448906e68cec5019fa83f7d31b862efff41e2da) --- source3/passdb/smbpassfile.c | 43 ------------------------------------------- 1 file changed, 43 deletions(-) (limited to 'source3/passdb') diff --git a/source3/passdb/smbpassfile.c b/source3/passdb/smbpassfile.c index 2456abe50a..0d4f9d3203 100644 --- a/source3/passdb/smbpassfile.c +++ b/source3/passdb/smbpassfile.c @@ -21,53 +21,10 @@ extern int DEBUGLEVEL; -static int gotalarm; int pw_file_lock_depth = 0; BOOL global_machine_password_needs_changing = False; -/*************************************************************** - Signal function to tell us we timed out. -****************************************************************/ - -static void gotalarm_sig(void) -{ - gotalarm = 1; -} - -/*************************************************************** - Lock or unlock a fd for a known lock type. Abandon after waitsecs - seconds. -****************************************************************/ - -BOOL do_file_lock(int fd, int waitsecs, int type) -{ - SMB_STRUCT_FLOCK lock; - int ret; - - gotalarm = 0; - CatchSignal(SIGALRM, SIGNAL_CAST gotalarm_sig); - - lock.l_type = type; - lock.l_whence = SEEK_SET; - lock.l_start = 0; - lock.l_len = 1; - lock.l_pid = 0; - - alarm(5); - ret = fcntl(fd, SMB_F_SETLKW, &lock); - alarm(0); - CatchSignal(SIGALRM, SIGNAL_CAST SIG_DFL); - - if (gotalarm) { - DEBUG(0, ("do_file_lock: failed to %s file.\n", - type == F_UNLCK ? "unlock" : "lock")); - return False; - } - - return (ret == 0); -} - /*************************************************************** Lock an fd. Abandon after waitsecs seconds. -- cgit