mirror of
https://github.com/troglobit/finit.git
synced 2026-10-08 16:34:45 +07:00
In rescue mode, always set hostname from /lib/finit/rescue.conf
If hostname is missing from /lib/finit/rescue.conf the system will default to the configured default hostname (noname). Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
@@ -184,6 +184,9 @@ void set_hostname(char **hostname)
|
||||
{
|
||||
FILE *fp;
|
||||
|
||||
if (rescue)
|
||||
goto done;
|
||||
|
||||
fp = fopen("/etc/hostname", "r");
|
||||
if (fp) {
|
||||
struct stat st;
|
||||
@@ -204,6 +207,7 @@ void set_hostname(char **hostname)
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
done:
|
||||
if (*hostname)
|
||||
sethostname(*hostname, strlen(*hostname));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user