Work around weird finding from Coverity Scan

The utmp_set() function allows id==NULL, so default the line to NULL and
avoid parsing empty lines.  Which is better code anyway.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2021-03-05 09:59:58 +01:00
parent c71bafd495
commit 9167d9255d
+2 -2
View File
@@ -194,13 +194,13 @@ static int set_getty(int type, char *tty, char *id, char *user)
return 0;
if (!tty)
line = "";
line = NULL;
else if (!strncmp(tty, "/dev/", 5))
line = tty + 5;
else
line = tty;
if (!id) {
if (!id && line) {
id = line;
if (!strncmp(id, "pts/", 4))
id += 4;