mirror of
https://github.com/troglobit/finit.git
synced 2026-11-03 13:28:27 +00:00
Refactor, convert struct tty members to static strings
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
406339e755
commit
e9670b87b3
4 files changed
+8
-14
No files matched your search
+1
-1
@@ -363,7 +363,7 @@ pid_t run_getty(char *tty, char *baud, char *term, int noclear, int nowait, stru
|
|||||||
if (!pid) {
|
if (!pid) {
|
||||||
speed_t speed = B38400;
|
speed_t speed = B38400;
|
||||||
|
|
||||||
if (baud) {
|
if (baud && baud[0]) {
|
||||||
speed = stty_parse_speed(baud);
|
speed = stty_parse_speed(baud);
|
||||||
if (B0 == speed)
|
if (B0 == speed)
|
||||||
logit(LOG_CRIT, "TTY %s: Invalid speed %s", tty, baud);
|
logit(LOG_CRIT, "TTY %s: Invalid speed %s", tty, baud);
|
||||||
|
|||||||
+1
-1
@@ -237,7 +237,7 @@ int getty(char *tty, speed_t speed, char *term, char *user)
|
|||||||
stty(fd, speed);
|
stty(fd, speed);
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
if (term)
|
if (term && term[0])
|
||||||
setenv("TERM", term, 1);
|
setenv("TERM", term, 1);
|
||||||
|
|
||||||
return do_login(name);
|
return do_login(name);
|
||||||
|
|||||||
@@ -238,9 +238,9 @@ int tty_register(char *line, struct rlimit rlimit[], char *file)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
entry->name = dev;
|
strlcpy(entry->name, dev, sizeof(entry->name));
|
||||||
entry->baud = baud ? strdup(baud) : NULL;
|
strlcpy(entry->baud, baud ? baud : "", sizeof(entry->baud));
|
||||||
entry->term = term ? strdup(term) : NULL;
|
strlcpy(entry->term, term ? term : "", sizeof(entry->term));
|
||||||
entry->noclear = noclear;
|
entry->noclear = noclear;
|
||||||
entry->nowait = nowait;
|
entry->nowait = nowait;
|
||||||
entry->nologin = nologin;
|
entry->nologin = nologin;
|
||||||
@@ -290,12 +290,6 @@ int tty_unregister(struct tty *tty)
|
|||||||
|
|
||||||
LIST_REMOVE(tty, link);
|
LIST_REMOVE(tty, link);
|
||||||
|
|
||||||
if (tty->name)
|
|
||||||
free(tty->name);
|
|
||||||
if (tty->baud)
|
|
||||||
free(tty->baud);
|
|
||||||
if (tty->term)
|
|
||||||
free(tty->term);
|
|
||||||
if (tty->cmd) {
|
if (tty->cmd) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user