summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--applypatch/applypatch.c2
-rw-r--r--recovery.cpp19
-rw-r--r--ui.cpp4
-rw-r--r--uncrypt/uncrypt.cpp12
-rw-r--r--updater/blockimg.c5
5 files changed, 25 insertions, 17 deletions
diff --git a/applypatch/applypatch.c b/applypatch/applypatch.c
index 6f02a38ee..2358d4292 100644
--- a/applypatch/applypatch.c
+++ b/applypatch/applypatch.c
@@ -662,7 +662,7 @@ size_t FreeSpaceForFile(const char* filename) {
printf("failed to statfs %s: %s\n", filename, strerror(errno));
return -1;
}
- return sf.f_bsize * sf.f_bfree;
+ return sf.f_bsize * sf.f_bavail;
}
int CacheSizeCheck(size_t bytes) {
diff --git a/recovery.cpp b/recovery.cpp
index 80a8c7ba5..bfc68950c 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -31,24 +31,24 @@
#include <time.h>
#include <unistd.h>
+#include <adb.h>
#include <base/file.h>
#include <base/stringprintf.h>
+#include <cutils/android_reboot.h>
+#include <cutils/properties.h>
+#include "adb_install.h"
#include "bootloader.h"
#include "common.h"
-#include "cutils/properties.h"
-#include "cutils/android_reboot.h"
+#include "device.h"
+#include "fuse_sdcard_provider.h"
+#include "fuse_sideload.h"
#include "install.h"
#include "minui/minui.h"
#include "minzip/DirUtil.h"
#include "roots.h"
#include "ui.h"
#include "screen_ui.h"
-#include "device.h"
-#include "adb_install.h"
-#include "adb.h"
-#include "fuse_sideload.h"
-#include "fuse_sdcard_provider.h"
struct selabel_handle *sehandle;
@@ -1119,6 +1119,9 @@ main(int argc, char **argv) {
property_set(ANDROID_RB_PROPERTY, "reboot,");
break;
}
- sleep(5); // should reboot before this finishes
+ while (true) {
+ pause();
+ }
+ // Should be unreachable.
return EXIT_SUCCESS;
}
diff --git a/ui.cpp b/ui.cpp
index 1a0b079cc..2efb759db 100644
--- a/ui.cpp
+++ b/ui.cpp
@@ -28,6 +28,7 @@
#include <time.h>
#include <unistd.h>
+#include <cutils/properties.h>
#include <cutils/android_reboot.h>
#include "common.h"
@@ -174,7 +175,8 @@ void RecoveryUI::ProcessKey(int key_code, int updown) {
case RecoveryUI::REBOOT:
if (reboot_enabled) {
- android_reboot(ANDROID_RB_RESTART, 0, 0);
+ property_set(ANDROID_RB_PROPERTY, "reboot,");
+ while (true) { pause(); }
}
break;
diff --git a/uncrypt/uncrypt.cpp b/uncrypt/uncrypt.cpp
index 11766f14c..d71271d8e 100644
--- a/uncrypt/uncrypt.cpp
+++ b/uncrypt/uncrypt.cpp
@@ -40,18 +40,20 @@
// file data to use as an update package.
#include <errno.h>
+#include <fcntl.h>
+#include <linux/fs.h>
+#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <stdarg.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include <fcntl.h>
-#include <linux/fs.h>
#include <sys/mman.h>
+#include <unistd.h>
#define LOG_TAG "uncrypt"
#include <log/log.h>
+#include <cutils/android_reboot.h>
#include <cutils/properties.h>
#include <fs_mgr.h>
@@ -376,7 +378,9 @@ static void wipe_misc() {
static void reboot_to_recovery() {
ALOGI("rebooting to recovery");
property_set("sys.powerctl", "reboot,recovery");
- sleep(10);
+ while (true) {
+ pause();
+ }
ALOGE("reboot didn't succeed?");
}
diff --git a/updater/blockimg.c b/updater/blockimg.c
index ce6360099..5d0f1560c 100644
--- a/updater/blockimg.c
+++ b/updater/blockimg.c
@@ -677,7 +677,7 @@ static int LoadStash(const char* base, const char* id, int verify, int* blocks,
lsout:
if (fd != -1) {
- TEMP_FAILURE_RETRY(close(fd));
+ close(fd);
}
if (fn) {
@@ -1485,7 +1485,6 @@ static int PerformCommandErase(CommandParameters* params) {
if (!S_ISBLK(st.st_mode)) {
fprintf(stderr, "not a block device; skipping erase\n");
- rc = 0;
goto pceout;
}
@@ -1509,7 +1508,7 @@ static int PerformCommandErase(CommandParameters* params) {
if (ioctl(params->fd, BLKDISCARD, &blocks) == -1) {
fprintf(stderr, "BLKDISCARD ioctl failed: %s\n", strerror(errno));
- // Continue anyway, nothing we can do
+ goto pceout;
}
}
}