utmp: move update_utmp
The functionality from this function is related to utmp. Restrict access to `setutmp()` to the same file. Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
This commit is contained in:
committed by
Serge Hallyn
parent
b6ca83ea4c
commit
6b7108e347
+12
-1
@@ -339,7 +339,7 @@ static void updwtmp (const char *filename, const struct utmp *ut)
|
||||
*
|
||||
* Return 1 on failure and 0 on success.
|
||||
*/
|
||||
int setutmp (struct utmp *ut)
|
||||
static int setutmp (struct utmp *ut)
|
||||
{
|
||||
int err = 0;
|
||||
|
||||
@@ -358,3 +358,14 @@ int setutmp (struct utmp *ut)
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
void update_utmp (const char *user,
|
||||
const char *tty,
|
||||
const char *host,
|
||||
/*@null@*/const struct utmp *utent)
|
||||
{
|
||||
struct utmp *ut = prepare_utmp (user, tty, host, utent);
|
||||
|
||||
(void) setutmp (ut); /* make entry in the utmp & wtmp files */
|
||||
free (ut);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user