mirror of
https://github.com/troglobit/finit.git
synced 2026-10-05 07:13:44 +07:00
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:
+2
-2
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user