~ubuntu-branches/debian/sid/obnam/sid

« back to all changes in this revision

Viewing changes to _obnammodule.c

  • Committer: Package Import Robot
  • Author(s): Lars Wirzenius
  • Date: 2015-07-01 18:14:49 UTC
  • Revision ID: package-import@ubuntu.com-20150701181449-taxcvqg9cviw2cxo
Tags: 1.10-1
* New upstream version.
  * Fix "restore to /tmp messes up directory perms" by preventing
    restores to a non-empty directory. (Closes: #760492)
* Add build-dependency on git.
* Drop build-dependency on texlive and building of PDF form of manual.
  Texlive is an insanely large build dependency.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * _obnammodule.c -- Python extensions for Obna
 
2
 * _obnammodule.c -- Python extensions for Obnam
3
3
 *
4
4
 * Copyright (C) 2008-2014  Lars Wirzenius <liw@liw.fi>
5
5
 *
48
48
#include <unistd.h>
49
49
#include <stdlib.h>
50
50
 
51
 
#ifdef __FreeBSD__
 
51
#if defined(__FreeBSD__)
52
52
    #include <sys/extattr.h>
53
53
    #define NO_NANOSECONDS 1
 
54
#elif defined(__APPLE__)
 
55
    #include <sys/xattr.h>
 
56
    #define NO_NANOSECONDS 1
 
57
    #define llistxattr(path, list, size) \
 
58
        (listxattr(path, list, size, XATTR_NOFOLLOW))
 
59
    #define lgetxattr(path, name, value, size) \
 
60
        (getxattr(path, name, value, size, 0, XATTR_NOFOLLOW))
 
61
    #define lsetxattr(path, name, value, size, flags) \
 
62
        (setxattr(path, name, value, size, 0, flags | XATTR_NOFOLLOW))
54
63
#else
55
64
    #include <sys/xattr.h>
56
65
    #define NO_NANOSECONDS 0
159
168
                         (long long) st.st_size,
160
169
                         (long long) st.st_blksize,
161
170
                         (long long) st.st_blocks,
 
171
#ifdef __APPLE__
 
172
                         (long long) st.st_atimespec.tv_sec,
 
173
                         remove_precision(st.st_atimespec.tv_nsec),
 
174
                         (long long) st.st_mtimespec.tv_sec,
 
175
                         remove_precision(st.st_mtimespec.tv_nsec),
 
176
                         (long long) st.st_ctimespec.tv_sec,
 
177
                         remove_precision(st.st_ctimespec.tv_nsec));
 
178
#else
162
179
                         (long long) st.st_atim.tv_sec,
163
180
                         remove_precision(st.st_atim.tv_nsec),
164
181
                         (long long) st.st_mtim.tv_sec,
165
182
                         remove_precision(st.st_mtim.tv_nsec),
166
183
                         (long long) st.st_ctim.tv_sec,
167
184
                         remove_precision(st.st_ctim.tv_nsec));
 
185
#endif
168
186
}
169
187
 
170
188
 
247
265
            return Py_None;
248
266
        }
249
267
#ifdef __FreeBSD__
250
 
        int n = extattr_get_link(filename, EXTATTR_NAMESPACE_USER, 
 
268
        int n = extattr_get_link(filename, EXTATTR_NAMESPACE_USER,
251
269
                                 attrname, buf, bufsize);
252
270
#else
253
271
        ssize_t n = lgetxattr(filename, attrname, buf, bufsize);
276
294
        return NULL;
277
295
 
278
296
#ifdef __FreeBSD__
279
 
    ret = extattr_set_link(filename, EXTATTR_NAMESPACE_USER, 
 
297
    ret = extattr_set_link(filename, EXTATTR_NAMESPACE_USER,
280
298
                           name, value, size);
281
299
#else
282
300
    ret = lsetxattr(filename, name, value, size, 0);