]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
main: Ensure that doubles in config files are parsed with '.'
authorRobin Ebert <ebertrobin2002@gmail.com>
Tue, 21 Sep 2021 13:42:04 +0000 (15:42 +0200)
committerRobin Ebert <ebertrobin2002@gmail.com>
Tue, 21 Sep 2021 14:11:16 +0000 (16:11 +0200)
src/main.c

index aa6f90b8040e57b0a63a13201f3bfa131423758f..8494beefe3fc213d5951c875f7b609c793ed85c1 100644 (file)
@@ -294,28 +294,13 @@ load_settings (state_t    *state,
         }
 
         if (isnan (state->splash_delay)) {
-                char *delay_string;
-
-                delay_string = ply_key_file_get_value (key_file, "Daemon", "ShowDelay");
-
-                if (delay_string != NULL) {
-                        state->splash_delay = atof (delay_string);
-                        ply_trace ("Splash delay is set to %lf", state->splash_delay);
-                        free (delay_string);
-                }
+                state->splash_delay = ply_key_file_get_double(key_file, "Daemon", "ShowDelay", NAN);
+                ply_trace ("Splash delay is set to %lf", state->splash_delay);
         }
 
         if (isnan (state->device_timeout)) {
-                char *timeout_string;
-
-                timeout_string = ply_key_file_get_value (key_file, "Daemon", "DeviceTimeout");
-
-                if (timeout_string != NULL) {
-                        state->device_timeout = atof (timeout_string);
-                        ply_trace ("Device timeout is set to %lf", state->device_timeout);
-
-                        free (timeout_string);
-                }
+                state->device_timeout = ply_key_file_get_double(key_file, "Daemon", "DeviceTimeout", NAN);
+                ply_trace ("Device timeout is set to %lf", state->device_timeout);
         }
 
         scale_string = ply_key_file_get_value (key_file, "Daemon", "DeviceScale");
@@ -391,7 +376,7 @@ find_override_splash (state_t *state)
                 delay_string = ply_kernel_command_line_get_string_after_prefix ("plymouth.splash-delay=");
 
                 if (delay_string != NULL)
-                        state->splash_delay = atof (delay_string);
+                        state->splash_delay = ply_strtod (delay_string);
         }
 }