]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
journald: use structure initialization
authorLennart Poettering <lennart@poettering.net>
Thu, 4 Apr 2019 15:30:51 +0000 (17:30 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 12 Apr 2019 12:23:08 +0000 (14:23 +0200)
src/journal/journald-server.c

index 2a960ebb3e7b147a5f5eb337c2b38c711dee5394..ac411df6491dbe1f78a11cd11b1a3d743457d8d1 100644 (file)
@@ -1820,32 +1820,43 @@ int server_init(Server *s) {
 
         assert(s);
 
-        zero(*s);
-        s->syslog_fd = s->native_fd = s->stdout_fd = s->dev_kmsg_fd = s->audit_fd = s->hostname_fd = s->notify_fd = -1;
-        s->compress.enabled = true;
-        s->compress.threshold_bytes = (uint64_t) -1;
-        s->seal = true;
-        s->read_kmsg = true;
+        *s = (Server) {
+                .syslog_fd = -1,
+                .native_fd = -1,
+                .stdout_fd = -1,
+                .dev_kmsg_fd = -1,
+                .audit_fd = -1,
+                .hostname_fd = -1,
+                .notify_fd = -1,
 
-        s->watchdog_usec = USEC_INFINITY;
+                .compress.enabled = true,
+                .compress.threshold_bytes = (uint64_t) -1,
+                .seal = true,
+                .read_kmsg = true,
 
-        s->sync_interval_usec = DEFAULT_SYNC_INTERVAL_USEC;
-        s->sync_scheduled = false;
+                .watchdog_usec = USEC_INFINITY,
+
+                .sync_interval_usec = DEFAULT_SYNC_INTERVAL_USEC,
+                .sync_scheduled = false,
 
-        s->rate_limit_interval = DEFAULT_RATE_LIMIT_INTERVAL;
-        s->rate_limit_burst = DEFAULT_RATE_LIMIT_BURST;
+                .rate_limit_interval = DEFAULT_RATE_LIMIT_INTERVAL,
+                .rate_limit_burst = DEFAULT_RATE_LIMIT_BURST,
 
-        s->forward_to_wall = true;
+                .forward_to_wall = true,
 
-        s->max_file_usec = DEFAULT_MAX_FILE_USEC;
+                .max_file_usec = DEFAULT_MAX_FILE_USEC,
 
-        s->max_level_store = LOG_DEBUG;
-        s->max_level_syslog = LOG_DEBUG;
-        s->max_level_kmsg = LOG_NOTICE;
-        s->max_level_console = LOG_INFO;
-        s->max_level_wall = LOG_EMERG;
+                .max_level_store = LOG_DEBUG,
+                .max_level_syslog = LOG_DEBUG,
+                .max_level_kmsg = LOG_NOTICE,
+                .max_level_console = LOG_INFO,
+                .max_level_wall = LOG_EMERG,
 
-        s->line_max = DEFAULT_LINE_MAX;
+                .line_max = DEFAULT_LINE_MAX,
+
+                .runtime_storage.name = "Runtime Journal",
+                .system_storage.name = "System Journal",
+        };
 
         journal_reset_metrics(&s->system_storage.metrics);
         journal_reset_metrics(&s->runtime_storage.metrics);
@@ -1996,9 +2007,6 @@ int server_init(Server *s) {
         server_cache_boot_id(s);
         server_cache_machine_id(s);
 
-        s->runtime_storage.name = "Runtime journal";
-        s->system_storage.name = "System journal";
-
         s->runtime_storage.path = strjoin("/run/log/journal/", SERVER_MACHINE_ID(s));
         s->system_storage.path  = strjoin("/var/log/journal/", SERVER_MACHINE_ID(s));
         if (!s->runtime_storage.path || !s->system_storage.path)