added chmod() and chown() to syscall.c
[rsync/rsync.git] / syscall.c
CommitLineData
31e12522
AT
1/*
2 Copyright (C) Andrew Tridgell 1998
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17*/
18
19/*
20 syscall wrappers to ensure that nothing gets done in dry_run mode
21 */
22
23#include "rsync.h"
24
25extern int dry_run;
26
27int do_unlink(char *fname)
28{
29 if (dry_run) return 0;
30 return unlink(fname);
31}
32
33int do_symlink(char *fname1, char *fname2)
34{
35 if (dry_run) return 0;
36 return symlink(fname1, fname2);
37}
38
39int do_link(char *fname1, char *fname2)
40{
41 if (dry_run) return 0;
42 return link(fname1, fname2);
43}
44
7308bd66
AT
45int do_lchown(const char *path, uid_t owner, gid_t group)
46{
47 if (dry_run) return 0;
48 return lchown(path, owner, group);
49}
50
31e12522
AT
51int do_mknod(char *pathname, mode_t mode, dev_t dev)
52{
53 if (dry_run) return 0;
54 return mknod(pathname, mode, dev);
55}
56
57int do_rmdir(char *pathname)
58{
59 if (dry_run) return 0;
60 return rmdir(pathname);
61}
62
63int do_open(char *pathname, int flags, mode_t mode)
64{
65 if (dry_run) return -1;
66 return open(pathname, flags, mode);
67}
7308bd66
AT
68
69int do_chmod(const char *path, mode_t mode)
70{
71 if (dry_run) return 0;
72 return chmod(path, mode);
73}