aboutsummaryrefslogtreecommitdiffstats
path: root/android
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@android.com>2011-05-05 10:24:43 +0200
committerDavid 'Digit' Turner <digit@android.com>2011-05-05 10:24:43 +0200
commitd80a7861fe5e21e3dcb80480a77b033e6b307dd5 (patch)
treecc032e1f277b45a73a940419f31fe9219b6a6acf /android
parent240c5cb1a24f5201472067a24c5d1ac54f6b8a20 (diff)
downloadexternal_qemu-d80a7861fe5e21e3dcb80480a77b033e6b307dd5.zip
external_qemu-d80a7861fe5e21e3dcb80480a77b033e6b307dd5.tar.gz
external_qemu-d80a7861fe5e21e3dcb80480a77b033e6b307dd5.tar.bz2
Fix -snapshot-list option.
This patch makes -snapshot-list work properly. More specifically: - If the AVD has snapshotting enabled, the emulator will find the appropriate file if you don't use -snapstorage. - If the AVD has no snapshot support, the emulator will print a user-friendly message to explain that. - If you're in the Android build, the emulator indicates that -snapstorage <file> is mandatory. Bug 4384430 Change-Id: I472b12f50b7f7da5a282b24036083c7598fe48eb
Diffstat (limited to 'android')
-rw-r--r--android/main.c15
-rw-r--r--android/snapshot.c2
2 files changed, 16 insertions, 1 deletions
diff --git a/android/main.c b/android/main.c
index 0682497..aa3ee46 100644
--- a/android/main.c
+++ b/android/main.c
@@ -261,6 +261,21 @@ int main(int argc, char **argv)
}
if (opts->snapshot_list) {
+ if (opts->snapstorage == NULL) {
+ /* Need to find the default snapstorage */
+ avd = createAVD(opts, &inAndroidBuild);
+ opts->snapstorage = avdInfo_getSnapStoragePath(avd);
+ if (opts->snapstorage != NULL) {
+ D("autoconfig: -snapstorage %s", opts->snapstorage);
+ } else {
+ if (inAndroidBuild) {
+ derror("You must use the -snapstorage <file> option to specify a snapshot storage file!\n");
+ } else {
+ derror("This AVD doesn't have snapshotting enabled!\n");
+ }
+ exit(1);
+ }
+ }
snapshot_print_and_exit(opts->snapstorage);
}
diff --git a/android/snapshot.c b/android/snapshot.c
index 047465f..d02d9a8 100644
--- a/android/snapshot.c
+++ b/android/snapshot.c
@@ -310,7 +310,7 @@ snapshot_print_and_exit( const char *snapstorage )
{
/* open snapshot file */
int fd = open(snapstorage, O_RDONLY);
- if (!fd) {
+ if (fd < 0) {
derror("Could not open snapshot file '%s': %s", snapstorage, strerror(errno));
exit(1);
}