From eb3ec90d80111a68ed7aa41d920c1bf25e093edc Mon Sep 17 00:00:00 2001 From: jpandre Date: Thu, 5 Nov 2009 11:48:27 +0000 Subject: [PATCH] OS X: implement setchgtime(), it fixes Firefox errors (Erik Larsson) --- src/ntfs-3g.c | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/src/ntfs-3g.c b/src/ntfs-3g.c index 1fb2baec..2ec127aa 100644 --- a/src/ntfs-3g.c +++ b/src/ntfs-3g.c @@ -479,14 +479,35 @@ int ntfs_macfuse_setbkuptime(const char *path, const struct timespec *tv) return -errno; /* - * Doing nothing while pretending to do something. NTFS has no backup - * time. If this function is not implemented then some apps break. + * Only pretending to set backup time successfully to please the APIs of + * Mac OS X. In reality, NTFS has no backup time. */ if (ntfs_inode_close(ni)) set_fuse_error(&res); return res; } + +int ntfs_macfuse_setchgtime(const char *path, const struct timespec *tv) +{ + ntfs_inode *ni; + int res = 0; + + if (ntfs_fuse_is_named_data_stream(path)) + return -EINVAL; /* n/a for named data streams. */ + ni = ntfs_pathname_to_inode(ctx->vol, NULL, path); + if (!ni) + return -errno; + + if (tv) { + ni->last_mft_change_time = tv->tv_sec; + ntfs_fuse_update_times(ni, 0); + } + + if (ntfs_inode_close(ni)) + set_fuse_error(&res); + return res; +} #else /* defined(__APPLE__) || defined(__DARWIN__) */ #ifdef FUSE_CAP_DONT_MASK static void *ntfs_init(struct fuse_conn_info *conn) @@ -3165,7 +3186,8 @@ static struct fuse_operations ntfs_3g_ops = { /* MacFUSE extensions. */ .getxtimes = ntfs_macfuse_getxtimes, .setcrtime = ntfs_macfuse_setcrtime, - .setbkuptime = ntfs_macfuse_setbkuptime + .setbkuptime = ntfs_macfuse_setbkuptime, + .setchgtime = ntfs_macfuse_setchgtime, #else /* defined(__APPLE__) || defined(__DARWIN__) */ #ifdef FUSE_CAP_DONT_MASK .init = ntfs_init