/[rdiff-backup]/rdiff-backup/rdiff_backup/cmodule.c
ViewVC logotype

Diff of /rdiff-backup/rdiff_backup/cmodule.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.20 by bescoto, Tue Aug 26 22:38:58 2003 UTC revision 1.21 by bescoto, Thu Aug 11 03:34:03 2005 UTC
# Line 368  static PyObject *acl_unquote(PyObject *s Line 368  static PyObject *acl_unquote(PyObject *s
368    return Py_BuildValue("s", unquote(s));    return Py_BuildValue("s", unquote(s));
369  }  }
370    
371    /* ------------- lchown taken from Python's posixmodule.c -------------- */
372    /* duplicate here to avoid v2.3 requirement */
373    
374    static PyObject *
375    posix_error_with_allocated_filename(char* name)
376    {
377            PyObject *rc = PyErr_SetFromErrnoWithFilename(PyExc_OSError, name);
378            PyMem_Free(name);
379            return rc;
380    }
381    
382    static PyObject *
383    posix_lchown(PyObject *self, PyObject *args)
384    {
385            char *path = NULL;
386            int uid, gid;
387            int res;
388            if (!PyArg_ParseTuple(args, "etii:lchown",
389                                  Py_FileSystemDefaultEncoding, &path,
390                                  &uid, &gid))
391                    return NULL;
392            Py_BEGIN_ALLOW_THREADS
393            res = lchown(path, (uid_t) uid, (gid_t) gid);
394            Py_END_ALLOW_THREADS
395            if (res < 0)
396                    return posix_error_with_allocated_filename(path);
397            PyMem_Free(path);
398            Py_INCREF(Py_None);
399            return Py_None;
400    }
401    
402  /* ------------- Python export lists -------------------------------- */  /* ------------- Python export lists -------------------------------- */
403    
# Line 381  static PyMethodDef CMethods[] = { Line 411  static PyMethodDef CMethods[] = {
411     "Quote string, escaping non-printables"},     "Quote string, escaping non-printables"},
412    {"acl_unquote", acl_unquote, METH_VARARGS,    {"acl_unquote", acl_unquote, METH_VARARGS,
413     "Unquote string, producing original input to quote"},     "Unquote string, producing original input to quote"},
414      {"lchown", posix_lchown, METH_VARARGS,
415       "Like chown, but don't follow symlinks"},
416    {NULL, NULL, 0, NULL}    {NULL, NULL, 0, NULL}
417  };  };
418    

Legend:
Removed from v.1.20  
changed lines
  Added in v.1.21

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26