]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/findlib/savecwd.h
XACL - refactoring an ACL and XATTR codes.
[bacula/bacula] / bacula / src / findlib / savecwd.h
1 /*
2    Bacula(R) - The Network Backup Solution
3
4    Copyright (C) 2000-2015 Kern Sibbald
5
6    The original author of Bacula is Kern Sibbald, with contributions
7    from many others, a complete list can be found in the file AUTHORS.
8
9    You may use this file and others of this release according to the
10    license defined in the LICENSE file, which includes the Affero General
11    Public License, v3.0 ("AGPLv3") and some additional permissions and
12    terms pursuant to its AGPLv3 Section 7.
13
14    This notice must be preserved when any source code is 
15    conveyed and/or propagated.
16
17    Bacula(R) is a registered trademark of Kern Sibbald.
18 */
19
20 /*
21  *  Kern Sibbald, August MMVII
22  *
23  */
24
25 #ifndef _SAVECWD_H
26 #define _SAVECWD_H 1
27
28 class saveCWD {
29    bool m_saved;                   /* set if we should do chdir i.e. save_cwd worked */
30    int m_fd;                       /* fd of current dir before chdir */
31    char *m_cwd;                    /* cwd before chdir if fd fchdir() works */
32
33 public:
34    saveCWD() { m_saved=false; m_fd=-1; m_cwd=NULL; };
35    ~saveCWD() { release(); };
36    bool save(JCR *jcr);
37    bool restore(JCR *jcr);
38    void release();
39    bool is_saved() { return m_saved; };
40 };
41
42 #endif /* _SAVECWD_H */