diff options
| author | Michael Biebl <biebl@debian.org> | 2020-07-13 22:06:54 +0200 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2020-07-13 22:06:54 +0200 |
| commit | c954a7079d01d0e5fad9c8ad99d8891d9e6f5bed (patch) | |
| tree | 3f24a6356fc531498ec6b091a67230eaf725145d /src/initrd/nm-initrd-generator.c | |
| parent | 36f77b6d9a724e4bc8e219b15fe446cd3a5e0099 (diff) | |
| parent | 136d191f1c96dbae1489fed7c2565f5e1b1f8d40 (diff) | |
Update upstream source from tag 'upstream/1.26.0'
Update to upstream version '1.26.0' with Debian dir ac612e9c69962647563dd4d6aa7499aacaf8aa3c
Diffstat (limited to 'src/initrd/nm-initrd-generator.c')
| -rw-r--r-- | src/initrd/nm-initrd-generator.c | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/src/initrd/nm-initrd-generator.c b/src/initrd/nm-initrd-generator.c index ac81dde0..f984ed73 100644 --- a/src/initrd/nm-initrd-generator.c +++ b/src/initrd/nm-initrd-generator.c @@ -130,22 +130,27 @@ main (int argc, char *argv[]) g_hash_table_foreach (connections, output_conn, connections_dir); g_hash_table_destroy (connections); - if (g_mkdir_with_parents (initrd_dir, 0755) != 0) { - errsv = errno; - _LOGW (LOGD_CORE, "%s: %s", initrd_dir, nm_strerror_native (errsv)); - return 1; - } + if (dump_to_stdout) { + if (hostname) + g_print ("\n*** Hostname '%s' ***\n", hostname); + } else { + if (g_mkdir_with_parents (initrd_dir, 0755) != 0) { + errsv = errno; + _LOGW (LOGD_CORE, "%s: %s", initrd_dir, nm_strerror_native (errsv)); + return 1; + } - if (hostname) { - gs_free char *hostname_file = NULL; - gs_free char *data = NULL; + if (hostname) { + gs_free char *hostname_file = NULL; + gs_free char *data = NULL; - hostname_file = g_strdup_printf ("%s/hostname", initrd_dir); - data = g_strdup_printf ("%s\n", hostname); + hostname_file = g_strdup_printf ("%s/hostname", initrd_dir); + data = g_strdup_printf ("%s\n", hostname); - if (!g_file_set_contents (hostname_file, data, strlen (data), &error)) { - _LOGW (LOGD_CORE, "%s: %s", hostname_file, error->message); - return 1; + if (!g_file_set_contents (hostname_file, data, strlen (data), &error)) { + _LOGW (LOGD_CORE, "%s: %s", hostname_file, error->message); + return 1; + } } } |