Allow registering TTYs that are not yet available

This patch removes the following very annoying warning for TTY devices
not yet available, i.e. plugged-in to the system.

Loading configuration ............................................................................. [ OK ]
[   11.097414] finit[1]:tty_register():Incomplete or non-existing TTY device given, cannot register.
[   11.101457] finit[1]:tty_register():Incomplete or non-existing TTY device given, cannot register.
Mounting filesystems .............................................................................. [ OK ]

Finit will not start a getty (built-in or external) if the TTY does not
exist, but having the configuration enabled makes it possible to do a
simple `initctl reload` to activate a plugged in TTY.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson
2017-10-14 13:14:48 +02:00
parent 97eca563b6
commit 38a274114d
+7 -1
View File
@@ -53,9 +53,15 @@ static char *canonicalize(char *tty)
strlcpy(path, tty, sizeof(path));
if (stat(path, &st)) {
if (!strncmp(path, _PATH_DEV, strlen(_PATH_DEV))) {
unavailable:
_d("TTY %s not available at the moment, registering anyway.", path);
return path;
}
snprintf(path, sizeof(path), "%s%s", _PATH_DEV, tty);
if (stat(path, &st))
return NULL;
goto unavailable;
}
if (!S_ISCHR(st.st_mode))