diff options
| author | Martin Pool <mbp@samba.org> | 2002-02-18 22:44:23 +0000 |
|---|---|---|
| committer | Martin Pool <mbp@samba.org> | 2002-02-18 22:44:23 +0000 |
| commit | ded8347d6b8aca7fafaeb8fea40b789d6425addd (patch) | |
| tree | 69ed0d518c5ddbd4ae1389bfe06918d074a89046 /syscall.c | |
| parent | c4a5c57dc3ad079ca7017f1881613937a602e72e (diff) | |
| download | android_external_rsync-ded8347d6b8aca7fafaeb8fea40b789d6425addd.tar.gz android_external_rsync-ded8347d6b8aca7fafaeb8fea40b789d6425addd.tar.bz2 android_external_rsync-ded8347d6b8aca7fafaeb8fea40b789d6425addd.zip | |
Cope with BSD systems on which mkdir() will not accept a trailing
slash.
<http://www.opensource.apple.com/bugs/X/BSD%20Kernel/2734739.html>
Diffstat (limited to 'syscall.c')
| -rw-r--r-- | syscall.c | 25 |
1 files changed, 20 insertions, 5 deletions
@@ -1,5 +1,6 @@ /* Copyright (C) Andrew Tridgell 1998 + Copyright (C) 2002 by Martin Pool This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,9 +17,12 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* - syscall wrappers to ensure that nothing gets done in dry_run mode - */ +/** + * @file syscall.c + * + * Syscall wrappers to ensure that nothing gets done in dry_run mode + * and to handle system peculiarities. + **/ #include "rsync.h" @@ -106,13 +110,24 @@ int do_rename(char *fname1, char *fname2) return rename(fname1, fname2); } + int do_mkdir(char *fname, mode_t mode) { - if (dry_run) return 0; - CHECK_RO + int l; + if (dry_run) + return 0; + CHECK_RO; + + /* Some BSD systems cannot make a directory if the name + * contains a trailing slash. + * <http://www.opensource.apple.com/bugs/X/BSD%20Kernel/2734739.html> */ + if ((l = strlen(fname)) && (fname[l-1] == '/')) + fname[l-1] = '/'; + return mkdir(fname, mode); } + /* like mkstemp but forces permissions */ int do_mkstemp(char *template, mode_t perms) { |
