+2008-06-09 Nicolas François <nicolas.francois@centraliens.net>
+
+ * src/logoutd.c: Use a bool when possible instead of int integers.
+ * src/logoutd.c: Avoid implicit conversion of pointers / integers
+ / chars to booleans.
+ * src/logoutd.c: Ignore return value of setlocale(),
+ bindtextdomain(), and textdomain().
+ * src/logoutd.c: Add brackets and parenthesis.
+
2008-06-09 Nicolas François <nicolas.francois@centraliens.net>
* src/chpasswd.c: Use a bool when possible instead of int
/*
* Check if they are allowed to be logged in right now.
*/
- if (!isttytime (user, ut->ut_line, now))
+ if (!isttytime (user, ut->ut_line, now)) {
return 0;
+ }
return 1;
}
{
TERMIO oldt, newt;
FILE *mesg_file, *tty_file;
- int c, is_tty;
+ int c;
+ bool is_tty;
tty_file = fdopen (tty_fd, "w");
- if (!tty_file)
+ if (NULL == tty_file) {
return;
+ }
is_tty = (GTTY (tty_fd, &oldt) == 0);
if (is_tty) {
}
mesg_file = fopen (HUP_MESG_FILE, "r");
- if (mesg_file) {
+ if (NULL != mesg_file) {
while ((c = getc (mesg_file)) != EOF) {
- if (c == '\n')
+ if (c == '\n') {
putc ('\r', tty_file);
+ }
putc (c, tty_file);
}
fclose (mesg_file);
char tty_name[sizeof (ut->ut_line) + 6]; /* /dev/ + NUL */
int tty_fd;
- setlocale (LC_ALL, "");
- bindtextdomain (PACKAGE, LOCALEDIR);
- textdomain (PACKAGE);
+ (void) setlocale (LC_ALL, "");
+ (void) bindtextdomain (PACKAGE, LOCALEDIR);
+ (void) textdomain (PACKAGE);
#ifndef DEBUG
for (i = 0; close (i) == 0; i++);
* Scan the utmpx/utmp file once per minute looking for users that
* are not supposed to still be logged in.
*/
- while (1) {
+ while (true) {
/*
* Attempt to re-open the utmpx/utmp file. The file is only
* is permitted to be signed on at this time.
*/
#if HAVE_UTMPX_H
- while ((ut = getutxent ())) {
+ while ((ut = getutxent ()) != NULL) {
#else
- while ((ut = getutent ())) {
+ while ((ut = getutent ()) != NULL) {
#endif
- if (ut->ut_type != USER_PROCESS)
+ if (ut->ut_type != USER_PROCESS) {
continue;
- if (ut->ut_user[0] == '\0')
+ }
+ if (ut->ut_user[0] == '\0') {
continue;
- if (check_login (ut))
+ }
+ if (check_login (ut)) {
continue;
+ }
/*
* Put the rest of this in a child process. This
}
/* child */
- if (strncmp (ut->ut_line, "/dev/", 5) != 0)
+ if (strncmp (ut->ut_line, "/dev/", 5) != 0) {
strcpy (tty_name, "/dev/");
- else
+ } else {
tty_name[0] = '\0';
+ }
strcat (tty_name, ut->ut_line);
#ifndef O_NOCTTY
return 1;
/* NOT REACHED */
}
+