lckpwdf Subroutine

Purpose

Locks the password database file.

Library

Security Library (libc.a)

Syntax

#include <pwd.h>
 
int lckpwdf() 

Description

The lckpwdf subroutine opens the temporary file and locks it to prevent the concurrent modification of the /etc/passwd and /etc/security/passwd database files.

The ulckpwdf subroutine can be called to release this lock. Both the lckpwdf and ulckpwdf subroutines use the /etc/security/.pwdlck database file as a lock file.

Note:
There is no protection against direct access of password database files or the programs that do not use the lckpwdf and ulckpwdf subroutines.

Return Values

Upon successful completion of attaining a lock, the lckpwdf subroutine returns a value of 0. Otherwise, a value of -1 is returned when the lock is acquired by other process.