commit | 00b260587cea0671801a34bf15840ea47b42ab39 | [log] [tgz] |
---|---|---|
author | Vojtech Bocek <vbocek@gmail.com> | Sat Jul 13 02:21:32 2013 +0200 |
committer | Gerrit Code Review <gerrit@198.50.184.117> | Sat Aug 24 07:52:45 2013 -0500 |
tree | a5900d9ce45f3ec3b535d3b40b25ee78ca6d96a1 | |
parent | 1c8d4fb0ead62ee88d890b3e0aa816513255439b [diff] |
Fix TWFunc::tw_chmod() for 3-character mode string
diff --git a/twrp-functions.cpp b/twrp-functions.cpp index d9014b3..29c70a5 100644 --- a/twrp-functions.cpp +++ b/twrp-functions.cpp
@@ -589,7 +589,8 @@ int TWFunc::tw_chmod(string fn, string mode) { long mask = 0; - for ( std::string::size_type n = 0; n < mode.length(); ++n) { + std::string::size_type n = (mode.length() == 3) ? 1 : 0; + for (; n < mode.length(); ++n) { if (n == 0) { if (mode[n] == '0') continue;