|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T p
Length: 712 (0x2c8) Types: TextFile Names: »pwlock.c«
└─⟦a0efdde77⟧ Bits:30001252 EUUGD11 Tape, 1987 Spring Conference Helsinki └─⟦this⟧ »EUUGD11/euug-87hel/sec8/mcp/src/pwlock.c«
#include <sys/types.h> #include <sys/file.h> #include "sysdep.h" extern time_t PWLockTime; static int pwlocked; lockpw() { int fd, i; time_t time(); for (i=1; i<5; i++) { if ((fd=open(PWDLOCK, O_WRONLY|O_CREAT|O_EXCL, 0644)) >= 0) { (void) time(&PWLockTime); (void) close(fd); pwlocked++; return(1); } else switch (i) { case 2: msg("Waiting for passwd lock..."); break; case 3: msg("Still waiting..."); break; case 4: msg("Pacing angrily..."); break; default: break; } sleep(2 * (unsigned)i); } return(0); } unlockpw() { if (!pwlocked) return; if (unlink(PWDLOCK) == -1) { perr("Warning: unable to unlock password file"); return; } pwlocked = 0; return; }