diff options
author | Elliott Hughes <enh@google.com> | 2015-03-28 11:23:32 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2015-03-28 11:26:15 -0700 |
commit | 56a0656ed91a01fdf09f9704a1f8a8aeb5d9f3b7 (patch) | |
tree | f1626d0d105f2aa1aff4ffbd6f8de0a12fff8b77 | |
parent | 6dbbcc57a00e6b44488e595d128e27168a939a02 (diff) | |
download | system_core-56a0656ed91a01fdf09f9704a1f8a8aeb5d9f3b7.zip system_core-56a0656ed91a01fdf09f9704a1f8a8aeb5d9f3b7.tar.gz system_core-56a0656ed91a01fdf09f9704a1f8a8aeb5d9f3b7.tar.bz2 |
Further cleanup of the logic in device_init.
Change-Id: I96e4b11894926b50792b9b7d7cfa0fe8392abef6
-rw-r--r-- | init/devices.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/init/devices.cpp b/init/devices.cpp index 1fa70ec..96b1696 100644 --- a/init/devices.cpp +++ b/init/devices.cpp @@ -992,22 +992,22 @@ void device_init() { /* is 256K enough? udev uses 16MB! */ device_fd = uevent_open_socket(256*1024, true); - if(device_fd < 0) + if (device_fd == -1) { return; - + } fcntl(device_fd, F_SETFL, O_NONBLOCK); - struct stat info; - if (stat(COLDBOOT_DONE, &info) < 0) { - Timer t; - coldboot("/sys/class"); - coldboot("/sys/block"); - coldboot("/sys/devices"); - close(open(COLDBOOT_DONE, O_WRONLY|O_CREAT|O_CLOEXEC, 0000)); - NOTICE("Coldboot took %.2fs.\n", t.duration()); - } else { + if (access(COLDBOOT_DONE, F_OK) == 0) { NOTICE("Skipping coldboot, already done!\n"); + return; } + + Timer t; + coldboot("/sys/class"); + coldboot("/sys/block"); + coldboot("/sys/devices"); + close(open(COLDBOOT_DONE, O_WRONLY|O_CREAT|O_CLOEXEC, 0000)); + NOTICE("Coldboot took %.2fs.\n", t.duration()); } int get_device_fd() |