Add support for octal, hexadecimal in restore.pl script.
[cumulus.git] / scandir.cc
index 4ffd078..dba840d 100644 (file)
@@ -280,7 +280,7 @@ void dump_inode(const string& path,         // Path within snapshot
 
     printf("%s\n", path.c_str());
 
-    file_info["mode"] = encode_int(stat_buf.st_mode & 07777);
+    file_info["mode"] = encode_int(stat_buf.st_mode & 07777, 8);
     file_info["mtime"] = encode_int(stat_buf.st_mtime);
     file_info["user"] = encode_int(stat_buf.st_uid);
     file_info["group"] = encode_int(stat_buf.st_gid);
@@ -617,11 +617,6 @@ int main(int argc, char *argv[])
         }
     }
 
-    if (argc < optind + 2) {
-        usage(argv[0]);
-        return 1;
-    }
-
     searches.push_back(".");
     if (optind == argc) {
         add_include(".");
@@ -723,7 +718,7 @@ int main(int argc, char *argv[])
     desc_filename = desc_filename + desc_buf + ".lbs";
     std::ofstream descriptor(desc_filename.c_str());
 
-    descriptor << "Format: LBS Snapshot v0.1\n";
+    descriptor << "Format: LBS Snapshot v0.2\n";
     descriptor << "Producer: LBS " << lbs_version << "\n";
     strftime(desc_buf, sizeof(desc_buf), "%Y-%m-%d %H:%M:%S %z", &time_buf);
     descriptor << "Date: " << desc_buf << "\n";