diff --git a/lib/vfs/utilvfs.c b/lib/vfs/utilvfs.c index f9a83989c..b322d63bf 100644 --- a/lib/vfs/utilvfs.c +++ b/lib/vfs/utilvfs.c @@ -406,3 +406,17 @@ vfs_get_timespecs_from_timesbuf (mc_timesbuf_t *times, mc_timespec_t *atime, mc_ } /* --------------------------------------------------------------------------------------------- */ + +void +vfs_get_timesbuf_from_stat (const struct stat *sb, mc_timesbuf_t *times) +{ +#ifdef HAVE_UTIMENSAT + (*times)[0] = sb->st_atim; + (*times)[1] = sb->st_mtim; +#else + times->actime = sb->st_atime; + times->modtime = sb->st_mtime; +#endif +} + +/* --------------------------------------------------------------------------------------------- */ diff --git a/lib/vfs/utilvfs.h b/lib/vfs/utilvfs.h index 49e6bc476..4f4772dd5 100644 --- a/lib/vfs/utilvfs.h +++ b/lib/vfs/utilvfs.h @@ -63,6 +63,7 @@ int vfs_parse_filedate (int idx, time_t * t); int vfs_utime (const char *path, mc_timesbuf_t *times); void vfs_get_timespecs_from_timesbuf (mc_timesbuf_t *times, mc_timespec_t *atime, mc_timespec_t *mtime); +void vfs_get_timesbuf_from_stat (const struct stat *sb, mc_timesbuf_t *times); /*** inline functions ****************************************************************************/ diff --git a/src/filemanager/file.c b/src/filemanager/file.c index f7f07960c..8ded73c9d 100644 --- a/src/filemanager/file.c +++ b/src/filemanager/file.c @@ -67,6 +67,7 @@ #include "lib/strutil.h" #include "lib/util.h" #include "lib/vfs/vfs.h" +#include "lib/vfs/utilvfs.h" #include "lib/widget.h" #include "src/setup.h" @@ -927,20 +928,6 @@ check_same_file (const char *a, const struct stat *ast, const char *b, const str return TRUE; } -/* --------------------------------------------------------------------------------------------- */ - -static void -get_times (const struct stat *sb, mc_timesbuf_t *times) -{ -#ifdef HAVE_UTIMENSAT - (*times)[0] = sb->st_atim; - (*times)[1] = sb->st_mtim; -#else - times->actime = sb->st_atime; - times->modtime = sb->st_mtime; -#endif -} - /* --------------------------------------------------------------------------------------------- */ /* {{{ Query/status report routines */ @@ -1297,7 +1284,7 @@ move_file_file (const WPanel *panel, file_op_total_context_t *tctx, file_op_cont { mc_timesbuf_t times; - get_times (&src_stat, ×); + vfs_get_timesbuf_from_stat (&src_stat, ×); mc_utime (dst_vpath, ×); } goto retry_src_remove; @@ -2375,7 +2362,7 @@ copy_file_file (file_op_total_context_t *tctx, file_op_context_t *ctx, } } - get_times (&src_stat, ×); + vfs_get_timesbuf_from_stat (&src_stat, ×); if (!ctx->do_append) { @@ -3232,7 +3219,7 @@ copy_dir_dir (file_op_total_context_t *tctx, file_op_context_t *ctx, const char if (attrs_ok) mc_fsetflags (dst_vpath, attrs); - get_times (&src_stat, ×); + vfs_get_timesbuf_from_stat (&src_stat, ×); mc_utime (dst_vpath, ×); } else