From a3c71b71e2033b92c74e54fc316ea42df2344ed2 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sun, 2 Jul 2017 10:36:46 -0700 Subject: QFileSystemEngine::setFileTime/Unix: remove the fallback to futimesat The use as in the code: futimesat(fd, NULL, &tv) is not documented to work. The file descriptor should be a directory's one, not an open file (though the Linux source code seems to handle that case). This call was done as a fallback to futimes, so it's very unlikely a system would have futimesat and not futimes. Both the Linux and the FreeBSD man pages say it's deprecated anyway. Change-Id: I8d96dea9955d4c749b99fffd14cd94068dc7668a Reviewed-by: Simon Hausmann Reviewed-by: Oswald Buddenhagen --- src/corelib/configure.json | 10 ---------- src/corelib/global/qconfig-bootstrapped.h | 1 - src/corelib/io/qfilesystemengine_unix.cpp | 8 ++------ 3 files changed, 2 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/corelib/configure.json b/src/corelib/configure.json index 61fc2e16c9..c8fede2b8f 100644 --- a/src/corelib/configure.json +++ b/src/corelib/configure.json @@ -279,11 +279,6 @@ "type": "compile", "test": "unix/futimes" }, - "futimesat": { - "label": "futimesat()", - "type": "compile", - "test": "unix/futimesat" - }, "getauxval": { "label": "getauxval()", "type": "compile", @@ -454,11 +449,6 @@ "condition": "!config.win32 && !features.futimens && tests.futimes", "output": [ "privateFeature" ] }, - "futimesat": { - "label": "futimesat()", - "condition": "!config.win32 && !features.futimens && !features.futimes && tests.futimesat", - "output": [ "privateFeature" ] - }, "getauxval": { "label": "getauxval()", "condition": "config.linux && tests.getauxval", diff --git a/src/corelib/global/qconfig-bootstrapped.h b/src/corelib/global/qconfig-bootstrapped.h index f1b99609ce..eb752354b1 100644 --- a/src/corelib/global/qconfig-bootstrapped.h +++ b/src/corelib/global/qconfig-bootstrapped.h @@ -83,7 +83,6 @@ #define QT_FEATURE_journald -1 #define QT_FEATURE_futimens -1 #define QT_FEATURE_futimes -1 -#define QT_FEATURE_futimesat -1 #define QT_FEATURE_library -1 #define QT_NO_QOBJECT #define QT_FEATURE_process -1 diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp index a1108e0fe6..0b16c62f76 100644 --- a/src/corelib/io/qfilesystemengine_unix.cpp +++ b/src/corelib/io/qfilesystemengine_unix.cpp @@ -157,7 +157,7 @@ static bool isPackage(const QFileSystemMetaData &data, const QFileSystemEntry &e } #endif -#if !QT_CONFIG(futimens) && (QT_CONFIG(futimes) || QT_CONFIG(futimesat)) +#if !QT_CONFIG(futimens) && (QT_CONFIG(futimes)) namespace { namespace GetFileTimes { @@ -873,7 +873,7 @@ bool QFileSystemEngine::setFileTime(int fd, const QDateTime &newDate, QAbstractF } return true; -#elif QT_CONFIG(futimes) || QT_CONFIG(futimesat) +#elif QT_CONFIG(futimes) struct timeval tv[2]; QT_STATBUF st; @@ -894,11 +894,7 @@ bool QFileSystemEngine::setFileTime(int fd, const QDateTime &newDate, QAbstractF tv[1].tv_usec = (msecs % 1000) * 1000; } -#if QT_CONFIG(futimes) if (futimes(fd, tv) == -1) { -#else - if (futimesat(fd, NULL, tv) == -1) { -#endif error = QSystemError(errno, QSystemError::StandardLibraryError); return false; } -- cgit v1.2.3