diff options
| author | Sebastien Bacher <seb128@ubuntu.com> | 2020-07-27 17:08:17 +0200 |
|---|---|---|
| committer | Sebastien Bacher <seb128@ubuntu.com> | 2020-07-27 17:09:21 +0200 |
| commit | c75fd9f7edaeaec5bc520b1e73afa83063cdc279 (patch) | |
| tree | cb044da62877cf9e3536a4d4e377cd3f20721ca8 /src/initrd/nm-initrd-generator.c | |
| parent | 68b70c827c50c51b5361c3cdd1764ff569b85d94 (diff) | |
| parent | f86436e83639986f20fb44663edcccf36c3c150c (diff) | |
Merge remote-tracking branch 'salsa/debian/master' into ubuntu/master
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; + } } } |