used utime and utimes as a fallback in fs-copy.c
This commit is contained in:
parent
ac6661de94
commit
67a5f4f5f5
@ -504,14 +504,15 @@ static int expand_wildcard (int argc, qse_char_t* argv[], int glob, xarg_t* xarg
|
|||||||
|
|
||||||
if (glob)
|
if (glob)
|
||||||
{
|
{
|
||||||
x = qse_glob (argv[i], collect_into_xarg, xarg,
|
|
||||||
QSE_GLOB_TOLERANT |
|
|
||||||
#if defined(_WIN32) || defined(__OS2__) || defined(__DOS__)
|
#if defined(_WIN32) || defined(__OS2__) || defined(__DOS__)
|
||||||
QSE_GLOB_NOESCAPE | QSE_GLOB_PERIOD | QSE_GLOB_IGNORECASE,
|
int glob_flags = QSE_GLOB_TOLERANT | QSE_GLOB_PERIOD | QSE_GLOB_NOESCAPE | QSE_GLOB_IGNORECASE;
|
||||||
#else
|
#else
|
||||||
QSE_GLOB_PERIOD,
|
int glob_flags = QSE_GLOB_TOLERANT | QSE_GLOB_PERIOD;
|
||||||
#endif
|
#endif
|
||||||
xarg->mmgr, qse_getdflcmgr()
|
|
||||||
|
x = qse_glob (
|
||||||
|
argv[i], collect_into_xarg, xarg,
|
||||||
|
glob_flags, xarg->mmgr, qse_getdflcmgr()
|
||||||
);
|
);
|
||||||
if (x <= -1) return -1;
|
if (x <= -1) return -1;
|
||||||
}
|
}
|
||||||
|
@ -674,12 +674,15 @@ static int expand_wildcards (int argc, qse_char_t* argv[], int glob, xarg_t* xar
|
|||||||
|
|
||||||
if (glob)
|
if (glob)
|
||||||
{
|
{
|
||||||
x = qse_glob (argv[i], collect_into_xarg, xarg,
|
|
||||||
#if defined(_WIN32) || defined(__OS2__) || defined(__DOS__)
|
#if defined(_WIN32) || defined(__OS2__) || defined(__DOS__)
|
||||||
QSE_GLOB_NOESCAPE | QSE_GLOB_IGNORECASE |
|
int glob_flags = QSE_GLOB_TOLERANT | QSE_GLOB_PERIOD | QSE_GLOB_NOESCAPE | QSE_GLOB_IGNORECASE;
|
||||||
|
#else
|
||||||
|
int glob_flags = QSE_GLOB_TOLERANT | QSE_GLOB_PERIOD;
|
||||||
#endif
|
#endif
|
||||||
QSE_GLOB_TOLERANT | QSE_GLOB_PERIOD,
|
|
||||||
xarg->mmgr, qse_getdflcmgr()
|
x = qse_glob (
|
||||||
|
argv[i], collect_into_xarg, xarg,
|
||||||
|
glob_flags, xarg->mmgr, qse_getdflcmgr()
|
||||||
);
|
);
|
||||||
|
|
||||||
if (x <= -1) return -1;
|
if (x <= -1) return -1;
|
||||||
|
@ -241,6 +241,10 @@ static int copy_file_in_fs (qse_fs_t* fs, cpfile_t* cpfile)
|
|||||||
struct timespec ts[2];
|
struct timespec ts[2];
|
||||||
#elif defined(HAVE_FUTIMES)
|
#elif defined(HAVE_FUTIMES)
|
||||||
struct timeval tv[2];
|
struct timeval tv[2];
|
||||||
|
#elif defined(HAVE_UTIME)
|
||||||
|
struct utimbuf ub;
|
||||||
|
#elif defined(HAVE_UTIMES)
|
||||||
|
struct timeval tv[2];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (QSE_FCHOWN (out, cpfile->src_attr.uid, cpfile->src_attr.gid) <= -1 ||
|
if (QSE_FCHOWN (out, cpfile->src_attr.uid, cpfile->src_attr.gid) <= -1 ||
|
||||||
@ -251,6 +255,8 @@ static int copy_file_in_fs (qse_fs_t* fs, cpfile_t* cpfile)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HAVE_FUTIMENS)
|
#if defined(HAVE_FUTIMENS)
|
||||||
|
|
||||||
|
QSE_MEMSET (&ts, 0, QSE_SIZEOF(ts));
|
||||||
ts[0].tv_sec = cpfile->src_attr.atime.sec;
|
ts[0].tv_sec = cpfile->src_attr.atime.sec;
|
||||||
ts[0].tv_nsec = cpfile->src_attr.atime.nsec;
|
ts[0].tv_nsec = cpfile->src_attr.atime.nsec;
|
||||||
ts[1].tv_sec = cpfile->src_attr.mtime.sec;
|
ts[1].tv_sec = cpfile->src_attr.mtime.sec;
|
||||||
@ -260,7 +266,10 @@ static int copy_file_in_fs (qse_fs_t* fs, cpfile_t* cpfile)
|
|||||||
fs->errnum = qse_fs_syserrtoerrnum (fs, errno);
|
fs->errnum = qse_fs_syserrtoerrnum (fs, errno);
|
||||||
goto oops;
|
goto oops;
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(HAVE_FUTIMES)
|
#elif defined(HAVE_FUTIMES)
|
||||||
|
|
||||||
|
QSE_MEMSET (&tv, 0, QSE_SIZEOF(tv));
|
||||||
tv[0].tv_sec = cpfile->src_attr.atime.sec;
|
tv[0].tv_sec = cpfile->src_attr.atime.sec;
|
||||||
tv[0].tv_usec = QSE_NSEC_TO_USEC(cpfile->src_attr.atime.nsec);
|
tv[0].tv_usec = QSE_NSEC_TO_USEC(cpfile->src_attr.atime.nsec);
|
||||||
tv[1].tv_sec = cpfile->src_attr.mtime.sec;
|
tv[1].tv_sec = cpfile->src_attr.mtime.sec;
|
||||||
@ -270,8 +279,34 @@ static int copy_file_in_fs (qse_fs_t* fs, cpfile_t* cpfile)
|
|||||||
fs->errnum = qse_fs_syserrtoerrnum (fs, errno);
|
fs->errnum = qse_fs_syserrtoerrnum (fs, errno);
|
||||||
goto oops;
|
goto oops;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#elif defined(HAVE_UTIME)
|
||||||
|
|
||||||
|
QSE_MEMSET (&ub, 0, QSE_SIZEOF(ub));
|
||||||
|
ub.actime = cpfile->src_attr.atime.sec;
|
||||||
|
ub.modtime = cpfile->src_attr.mtime.sec;
|
||||||
|
if (QSE_UTIME (cpfile->dst_fspath, &ub) <= -1)
|
||||||
|
{
|
||||||
|
fs->errnum = qse_fs_syserrtoerrnum (fs, errno);
|
||||||
|
goto oops;
|
||||||
|
}
|
||||||
|
|
||||||
|
#elif defined(HAVE_UTIMES)
|
||||||
|
|
||||||
|
QSE_MEMSET (&tv, 0, QSE_SIZEOF(tv));
|
||||||
|
tv[0].tv_sec = cpfile->src_attr.atime.sec;
|
||||||
|
tv[0].tv_usec = QSE_NSEC_TO_USEC(cpfile->src_attr.atime.nsec);
|
||||||
|
tv[1].tv_sec = cpfile->src_attr.mtime.sec;
|
||||||
|
tv[1].tv_usec = QSE_NSEC_TO_USEC(cpfile->src_attr.mtime.nsec);
|
||||||
|
// work on the file name not on the file descriptor.
|
||||||
|
if (QSE_UTIMES (cpfile->dst_fspath, tv) <= -1)
|
||||||
|
{
|
||||||
|
fs->errnum = qse_fs_syserrtoerrnum (fs, errno);
|
||||||
|
goto oops;
|
||||||
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
# error neither futimens nor futimes exist
|
# error none of futimens, futimes, utime, utimes exist
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user