{0, 0, 0, 0}
};
- while ((opt = getopt_long(argc, argv, "ag:m:", options, &index)) != -1) {
- switch (opt) {
- case 'a':
- ret = mountEcryptfsToAll();
- break;
- case 'g':
- ret = generateKey(optarg);
- break;
- case 'm':
- ret = mountEcryptfs("/home/" + std::string(optarg), optarg);
- break;
- default:
- std::cerr << "unknown" << std::endl;
- usage(argv[0]);
- break;
+ try {
+ while ((opt = getopt_long(argc, argv, "ag:m:", options, &index)) != -1) {
+ switch (opt) {
+ case 'a':
+ ret = mountEcryptfsToAll();
+ break;
+ case 'g':
+ ret = generateKey(optarg);
+ break;
+ case 'm':
+ ret = mountEcryptfs("/home/" + std::string(optarg), optarg);
+ break;
+ default:
+ std::cerr << "unknown" << std::endl;
+ usage(argv[0]);
+ break;
+ }
}
+ } catch (klay::Exception &e) {
+ ret = -1;
}
if (ret != 0) {