am 7e113e39: am 9a22c68e: merge from open-source master
diff --git a/fastboot/engine.c b/fastboot/engine.c
index 6d62c6e..f29cc03 100644
--- a/fastboot/engine.c
+++ b/fastboot/engine.c
@@ -271,11 +271,11 @@
     a->data = (void*) notice;
 }
 
-void fb_execute_queue(usb_handle *usb)
+int fb_execute_queue(usb_handle *usb)
 {
     Action *a;
     char resp[FB_RESPONSE_SZ+1];
-    int status;
+    int status = 0;
 
     a = action_list;
     resp[FB_RESPONSE_SZ] = 0;
@@ -307,5 +307,5 @@
     }
 
     fprintf(stderr,"finished. total time: %.3fs\n", (now() - start));
+    return status;
 }
-
diff --git a/fastboot/fastboot.c b/fastboot/fastboot.c
index bed30b2..5389351 100644
--- a/fastboot/fastboot.c
+++ b/fastboot/fastboot.c
@@ -550,11 +550,12 @@
     void *data;
     unsigned sz;
     unsigned page_size = 2048;
+    int status;
 
     skip(1);
     if (argc == 0) {
         usage();
-        return 0;
+        return 1;
     }
 
     if (!strcmp(*argv, "devices")) {
@@ -686,6 +687,7 @@
             argc = do_oem_command(argc, argv);
         } else {
             usage();
+	    return 1;
         }
     }
 
@@ -701,6 +703,6 @@
 
     usb = open_device();
 
-    fb_execute_queue(usb);
-    return 0;
+    status = fb_execute_queue(usb);
+    return (status) ? 1 : 0;
 }
diff --git a/fastboot/fastboot.h b/fastboot/fastboot.h
index a36c569..a4b27a0 100644
--- a/fastboot/fastboot.h
+++ b/fastboot/fastboot.h
@@ -49,7 +49,7 @@
 void fb_queue_command(const char *cmd, const char *msg);
 void fb_queue_download(const char *name, void *data, unsigned size);
 void fb_queue_notice(const char *notice);
-void fb_execute_queue(usb_handle *usb);
+int fb_execute_queue(usb_handle *usb);
 
 /* util stuff */
 void die(const char *fmt, ...);