We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fea9d9a commit 16a4966Copy full SHA for 16a4966
1 file changed
src/openrc/rc.c
@@ -451,12 +451,33 @@ handle_signal(int sig)
451
errno = serrno;
452
}
453
454
+static void
455
+do_early_hostname(void)
456
+{
457
+#ifdef __linux__
458
+ /* Set hostname if available */
459
+ char *buffer = NULL;
460
+ size_t len;
461
+
462
+ if (rc_getfile(RC_SYSCONFDIR "/hostname", &buffer, &len)) {
463
+ if (buffer[len - 2] == '\n')
464
+ buffer[--len - 1] = '\0';
465
+ if (sethostname(buffer, len)) {
466
+ /* ignore */;
467
+ }
468
+ free(buffer);
469
470
+#endif
471
+}
472
473
static void
474
do_sysinit()
475
{
476
struct utsname uts;
477
const char *sys;
478
479
+ do_early_hostname();
480
481
/* exec init-early.sh if it exists
482
* This should just setup the console to use the correct
483
* font. Maybe it should setup the keyboard too? */
0 commit comments