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