From 56ee715e01606fc18cbfb65bcdc20cf920dbb026 Mon Sep 17 00:00:00 2001 From: ksherlock Date: Sat, 29 May 2010 18:11:34 +0000 Subject: [PATCH] git-svn-id: https://profuse.googlecode.com/svn/branches/v2@293 aa027e90-d47c-11dd-86d7-074df07e0730 --- apfm.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/apfm.cpp b/apfm.cpp index 357feeb..76b249c 100644 --- a/apfm.cpp +++ b/apfm.cpp @@ -146,6 +146,17 @@ void commandUsage(unsigned command) } +bool isReadOnly(const char *command) +{ + if (!::strcasecmp(command, "mv")) return false; + if (!::strcasecmp(command, "rm")) return false; + if (!::strcasecmp(command, "cp")) return false; + if (!::strcasecmp(command, "put")) return false; + if (!::strcasecmp(command, "krunch")) return false; + + return true; +} + // from BSD rm, prompt question on stderr. bool yes_or_no() @@ -708,7 +719,7 @@ int main(int argc, char **argv) // should we peek at the action to determine if read only? - device.reset( Device::BlockDevice::Open(file, false, fmt) ); + device.reset( Device::BlockDevice::Open(file, isReadOnly(action), fmt) );