Commit 86ef64a6 authored by bescoto's avatar bescoto

Avoid lchown requirement


git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup@630 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
parent 34d2bd34
......@@ -22,6 +22,8 @@ outside path. Bug with --restrict option allowed writes outside path.
bug #14304: Python 2.2 compatibility spoiled by device files.
lchown no longer required, which is good news for Mac OS X 10.3.
New in v1.0.0 (2005/08/14)
--------------------------
......
......@@ -371,6 +371,7 @@ static PyObject *acl_unquote(PyObject *self, PyObject *args)
/* ------------- lchown taken from Python's posixmodule.c -------------- */
/* duplicate here to avoid v2.3 requirement */
#ifdef HAVE_LCHOWN
static PyObject *
posix_error_with_allocated_filename(char* name)
{
......@@ -398,6 +399,7 @@ posix_lchown(PyObject *self, PyObject *args)
Py_INCREF(Py_None);
return Py_None;
}
#endif /* HAVE_LCHOWN */
/* ------------- Python export lists -------------------------------- */
......@@ -411,8 +413,10 @@ static PyMethodDef CMethods[] = {
"Quote string, escaping non-printables"},
{"acl_unquote", acl_unquote, METH_VARARGS,
"Unquote string, producing original input to quote"},
#ifdef HAVE_LCHOWN
{"lchown", posix_lchown, METH_VARARGS,
"Like chown, but don't follow symlinks"},
#endif /* HAVE_LCHOWN */
{NULL, NULL, 0, NULL}
};
......
......@@ -782,7 +782,12 @@ class RPath(RORPath):
def chown(self, uid, gid):
"""Set file's uid and gid"""
self.conn.C.lchown(self.path, uid, gid)
if self.issym():
try: self.conn.C.lchown(self.path, uid, gid)
except AttributeError:
log.Log("Warning: lchown missing, cannot change ownership "
"of symlink " + self.path, 2)
else: os.chown(self.path, uid, gid)
self.data['uid'] = uid
self.data['gid'] = gid
......
......@@ -93,6 +93,7 @@ def InternalBackup(source_local, dest_local, src_dir, dest_dir,
"""
Globals.current_time = current_time
#_reset_connections()
Globals.security_level = "override"
remote_schema = '%s'
if not source_local:
......@@ -174,6 +175,7 @@ def get_increment_rp(mirror_rp, time):
def _reset_connections(src_rp, dest_rp):
"""Reset some global connection information"""
Globals.security_level = "override"
Globals.isbackup_reader = Globals.isbackup_writer = None
#Globals.connections = [Globals.local_connection]
#Globals.connection_dict = {0: Globals.local_connection}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment