* libmisc/utmp.c (checkutmp): Change picky argument's type to
bool. * libmisc/utmp.c: Use bool when possible (found_utmpx, found_utmp). * libmisc/utmp.c: Add note about unchecked return values.
This commit is contained in:
parent
9d331bb32b
commit
7069324a20
@ -1,3 +1,11 @@
|
|||||||
|
2008-05-25 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
|
* libmisc/utmp.c (checkutmp): Change picky argument's type to
|
||||||
|
bool.
|
||||||
|
* libmisc/utmp.c: Use bool when possible (found_utmpx,
|
||||||
|
found_utmp).
|
||||||
|
* libmisc/utmp.c: Add note about unchecked return values.
|
||||||
|
|
||||||
2008-05-25 Nicolas François <nicolas.francois@centraliens.net>
|
2008-05-25 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
* libmisc/addgrps.c: Change type of added to bool.
|
* libmisc/addgrps.c: Change type of added to bool.
|
||||||
|
@ -115,7 +115,7 @@ void checkutmp (int picky)
|
|||||||
|
|
||||||
#elif defined(LOGIN_PROCESS)
|
#elif defined(LOGIN_PROCESS)
|
||||||
|
|
||||||
void checkutmp (int picky)
|
void checkutmp (bool picky)
|
||||||
{
|
{
|
||||||
char *line;
|
char *line;
|
||||||
struct utmp *ut;
|
struct utmp *ut;
|
||||||
@ -281,7 +281,7 @@ void setutmp (const char *name, const char *line, const char *host)
|
|||||||
struct utmp *utmp, utline;
|
struct utmp *utmp, utline;
|
||||||
struct utmpx *utmpx, utxline;
|
struct utmpx *utmpx, utxline;
|
||||||
pid_t pid = getpid ();
|
pid_t pid = getpid ();
|
||||||
int found_utmpx = 0, found_utmp = 0;
|
bool found_utmpx = false, found_utmp = false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The canonical device name doesn't include "/dev/"; skip it
|
* The canonical device name doesn't include "/dev/"; skip it
|
||||||
@ -301,13 +301,13 @@ void setutmp (const char *name, const char *line, const char *host)
|
|||||||
|
|
||||||
while (utmpx = getutxent ()) {
|
while (utmpx = getutxent ()) {
|
||||||
if (utmpx->ut_pid == pid) {
|
if (utmpx->ut_pid == pid) {
|
||||||
found_utmpx = 1;
|
found_utmpx = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (utmp = getutent ()) {
|
while (utmp = getutent ()) {
|
||||||
if (utmp->ut_pid == pid) {
|
if (utmp->ut_pid == pid) {
|
||||||
found_utmp = 1;
|
found_utmp = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -369,6 +369,7 @@ void setutmp (const char *name, const char *line, const char *host)
|
|||||||
|
|
||||||
pututxline (&utxline);
|
pututxline (&utxline);
|
||||||
pututline (&utline);
|
pututline (&utline);
|
||||||
|
/* TODO: log failures */
|
||||||
|
|
||||||
updwtmpx (_WTMP_FILE "x", &utxline);
|
updwtmpx (_WTMP_FILE "x", &utxline);
|
||||||
updwtmp (_WTMP_FILE, &utline);
|
updwtmp (_WTMP_FILE, &utline);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user