~gencfsm/gencfsm/trunk

« back to all changes in this revision

Viewing changes to src/encfs/encfs_wrapper2.vala

  • Committer: Moritz Molch
  • Date: 2014-04-28 16:58:31 UTC
  • Revision ID: mail@moritzmolch.de-20140428165831-vi7ak9fh5pvpbmm7
Better error-handling for directories when mounting / creating stashes
Better support for restricted directories (e.g. /media)

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
                        callback(false, _(exit_stderr));
52
52
                        return;
53
53
                    }
 
54
                } catch (Error e) {
 
55
                    callback(false, "Mount directory: " + e.message);
 
56
                return;
54
57
                }
55
 
                catch (Error e) { return; }
56
58
            
57
59
            try {
58
60
                    FileEnumerator enumerator = File.new_for_path(s.mountDir).enumerate_children (
59
61
                            "standard::*",
60
62
                            FileQueryInfoFlags.NOFOLLOW_SYMLINKS, 
61
63
                            null);
62
 
                    //FileInfo info = null;
 
64
 
63
65
                    if (enumerator.next_file(null) != null) {
64
66
                    callback(false, _("The mount folder is not empty"));
65
67
                    return;
66
68
                    }
67
 
                } catch (Error e) { return; }
 
69
                } catch (Error e) {
 
70
                    callback(false, "Mount directory: " + e.message);
 
71
                return;
 
72
                }
68
73
 
69
74
            
70
75
            int fd[3];
96
101
                                        argv.add(opt);
97
102
                                        GLib.stdout.printf(" "+opt);
98
103
                                    }
99
 
                        }
100
 
                        catch (Error e) {}
 
104
                    } catch (Error e) {
 
105
                        callback(false, e.message);
 
106
                        return;
 
107
                    }
101
108
            }
102
109
            
103
110
            argv.add(s.cryptDir);
374
381
 
375
382
                }
376
383
                catch (Error e) {
377
 
                }
378
 
            if (rmdir (s.mountDir) == -1) {
379
 
                
380
 
                rmdir(s.cryptDir);
381
 
                callback(1, _("The mount folder is not empty"));
382
 
                return;
383
 
            }
384
 
            
385
 
            mkdir (s.mountDir, 0700);
 
384
                    callback(1, e.message);
 
385
                return;
 
386
                }
 
387
                
 
388
            try {
 
389
                    FileEnumerator enumerator = File.new_for_path(s.mountDir).enumerate_children (
 
390
                            "standard::*",
 
391
                            FileQueryInfoFlags.NOFOLLOW_SYMLINKS, 
 
392
                            null);
 
393
                    //FileInfo info = null;
 
394
                    if (enumerator.next_file(null) != null) {
 
395
                    callback(1, _("The mount folder is not empty"));
 
396
                    return;
 
397
                    }
 
398
                } catch (Error e) {
 
399
                    callback(1, "Mount directory: " + e.message);
 
400
                return;
 
401
                }
386
402
 
387
403
            
388
404
            int fd[3];