lib/, src/: Reduce scope of local variables
Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
committed by
Serge Hallyn
parent
847a19e7a3
commit
5e11e89fd9
+3
-2
@@ -574,9 +574,7 @@ static void add_one_entry_nis (struct commonio_db *db,
|
||||
int commonio_open (struct commonio_db *db, int mode)
|
||||
{
|
||||
char *buf;
|
||||
char *cp;
|
||||
char *line;
|
||||
struct commonio_entry *p;
|
||||
void *eptr = NULL;
|
||||
int flags = mode;
|
||||
size_t buflen;
|
||||
@@ -642,6 +640,9 @@ int commonio_open (struct commonio_db *db, int mode)
|
||||
}
|
||||
|
||||
while (db->ops->fgets (buf, buflen, db->fp) == buf) {
|
||||
char *cp;
|
||||
struct commonio_entry *p;
|
||||
|
||||
while ( (strrchr (buf, '\n') == NULL)
|
||||
&& (feof (db->fp) == 0)) {
|
||||
size_t len;
|
||||
|
||||
+6
-7
@@ -120,14 +120,8 @@ static void send_mesg_to_tty (int tty_fd)
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
pid_t pid;
|
||||
|
||||
struct utmpx *ut;
|
||||
char user[sizeof (ut->ut_user) + 1]; /* terminating NUL */
|
||||
char tty_name[sizeof (ut->ut_line) + 6]; /* /dev/ + NUL */
|
||||
int tty_fd;
|
||||
|
||||
if (1 != argc) {
|
||||
(void) fputs (_("Usage: logoutd\n"), stderr);
|
||||
}
|
||||
@@ -137,7 +131,7 @@ main(int argc, char **argv)
|
||||
(void) textdomain (PACKAGE);
|
||||
|
||||
#ifndef DEBUG
|
||||
for (i = 0; close (i) == 0; i++);
|
||||
for (int i = 0; close(i) == 0; i++);
|
||||
|
||||
setpgrp ();
|
||||
|
||||
@@ -168,6 +162,7 @@ main(int argc, char **argv)
|
||||
* are not supposed to still be logged in.
|
||||
*/
|
||||
while (true) {
|
||||
struct utmpx *ut;
|
||||
|
||||
/*
|
||||
* Attempt to re-open the utmp file. The file is only
|
||||
@@ -181,6 +176,10 @@ main(int argc, char **argv)
|
||||
* is permitted to be signed on at this time.
|
||||
*/
|
||||
while ((ut = getutxent()) != NULL) {
|
||||
int tty_fd;
|
||||
char user[sizeof(ut->ut_user) + 1]; // NUL
|
||||
char tty_name[sizeof(ut->ut_line) + 6]; // /dev/ + NUL
|
||||
|
||||
if (ut->ut_type != USER_PROCESS) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user