slash.
<http://www.opensource.apple.com/bugs/X/BSD%20Kernel/
2734739.html>
* Fix for rsync server processes hanging around after the client
unexpectedly disconnects. (Colin Walters) (Debian bug #128632)
* Fix for rsync server processes hanging around after the client
unexpectedly disconnects. (Colin Walters) (Debian bug #128632)
+ * Cope with BSD systems on which mkdir() will not accept a trailing
+ slash.
+
ENHANCEMENTS:
* Command to initiate connections is only shown with -vv, rather
ENHANCEMENTS:
* Command to initiate connections is only shown with -vv, rather
/*
Copyright (C) Andrew Tridgell 1998
/*
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
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
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
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.
+ **/
return rename(fname1, fname2);
}
return rename(fname1, fname2);
}
int do_mkdir(char *fname, mode_t mode)
{
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);
}
return mkdir(fname, mode);
}
/* like mkstemp but forces permissions */
int do_mkstemp(char *template, mode_t perms)
{
/* like mkstemp but forces permissions */
int do_mkstemp(char *template, mode_t perms)
{