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 <simon.hausmann@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
This commit is contained in:
parent
6c3a3d498a
commit
a3c71b71e2
@ -1,47 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 Raphael Gozzo <raphael.rg91@gmail.com>
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the config.tests of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL3 included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 3 requirements
|
||||
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 2.0 or (at your option) the GNU General
|
||||
** Public license version 3 or any later version approved by the KDE Free
|
||||
** Qt Foundation. The licenses are as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
||||
** https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <sys/time.h>
|
||||
|
||||
int main(int, char **)
|
||||
{
|
||||
futimesat(-1,0,0);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1 +0,0 @@
|
||||
SOURCES += futimesat.cpp
|
@ -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",
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user