tool/CommandFoeWrite.cpp
changeset 1826 ec6223c3b7ec
parent 1804 742607c464c4
child 1869 14f634f5b613
--- a/tool/CommandFoeWrite.cpp	Tue Feb 23 17:40:46 2010 +0100
+++ b/tool/CommandFoeWrite.cpp	Wed Feb 24 16:27:11 2010 +0100
@@ -37,6 +37,7 @@
 
 #include "CommandFoeWrite.h"
 #include "foe.h"
+#include "MasterDevice.h"
 
 /*****************************************************************************/
 
@@ -79,7 +80,7 @@
 
 /****************************************************************************/
 
-void CommandFoeWrite::execute(MasterDevice &m, const StringVector &args)
+void CommandFoeWrite::execute(const StringVector &args)
 {
     stringstream err;
     ec_ioctl_slave_foe_t data;
@@ -92,6 +93,12 @@
         throwInvalidUsageException(err);
     }
 
+    if (getMasterIndices().size() != 1) {
+        err << getName() << " requires to select a single master!";
+        throwInvalidUsageException(err);
+    }
+    MasterDevice m(getMasterIndices().front());
+
     if (args[0] == "-") {
         loadFoeData(&data, cin);
         if (getOutputFile().empty()) {