summaryrefslogtreecommitdiff
path: root/_obnammodule.c
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2012-02-25 20:49:37 +0000
committerLars Wirzenius <liw@liw.fi>2012-02-25 20:49:37 +0000
commit833f0196e94c74afff34433a2734d39521e2f3da (patch)
tree51c404337569e56788736fd2b036f2c4c3171824 /_obnammodule.c
parent4bca0647d10dcee2073b2d23ab15d8bc855e7383 (diff)
downloadobnam-833f0196e94c74afff34433a2734d39521e2f3da.tar.gz
Fix argument passing to the utimensat wrapper
A struct timespec does not have two long fields; the seconds are a time_t. We need to deal with that.
Diffstat (limited to '_obnammodule.c')
-rw-r--r--_obnammodule.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/_obnammodule.c b/_obnammodule.c
index 42d9847a..5e377e97 100644
--- a/_obnammodule.c
+++ b/_obnammodule.c
@@ -74,16 +74,22 @@ utimensat_wrapper(PyObject *self, PyObject *args)
{
int ret;
const char *filename;
+ long atime_sec, atime_nsec;
+ long mtime_sec, mtime_nsec;
struct timespec tv[2];
if (!PyArg_ParseTuple(args, "sllll",
&filename,
- &tv[0].tv_sec,
- &tv[0].tv_nsec,
- &tv[1].tv_sec,
- &tv[1].tv_nsec))
+ &atime_sec,
+ &atime_nsec,
+ &mtime_sec,
+ &mtime_nsec))
return NULL;
+ tv[0].tv_sec = atime_sec;
+ tv[0].tv_nsec = atime_nsec;
+ tv[1].tv_sec = mtime_sec;
+ tv[1].tv_nsec = mtime_nsec;
ret = utimensat(AT_FDCWD, filename, tv, AT_SYMLINK_NOFOLLOW);
if (ret == -1)
ret = errno;