diff options
author | Antti Määttä <antti.maatta@qt.io> | 2023-05-29 09:02:16 +0300 |
---|---|---|
committer | Antti Määttä <antti.maatta@qt.io> | 2023-06-02 17:53:24 +0300 |
commit | 5e2b4c401d19f2067a9ce799883113f59cb66607 (patch) | |
tree | a5a0e3946961a6a8f9b1b3a7010979a5367744cb /src | |
parent | 0006a564c85d49153288cd3834197effed53394e (diff) |
CTF: Use access to check if location is writable
Pick-to: 6.5
Change-Id: Ic6afcf74432f176374d47e828b480e4d2499c670
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/tracing/qctflib.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/plugins/tracing/qctflib.cpp b/src/plugins/tracing/qctflib.cpp index 28016982dd..9311bb1fdd 100644 --- a/src/plugins/tracing/qctflib.cpp +++ b/src/plugins/tracing/qctflib.cpp @@ -62,16 +62,13 @@ QCtfLibImpl::QCtfLibImpl() } // Check if the location is writable - FILE *file = nullptr; - file = fopen(qPrintable(location + "/metadata"_L1), "w+b"); - if (!file) { + if (QT_ACCESS(qPrintable(location), W_OK) != 0) { qCWarning (lcDebugTrace) << "Unable to write to location"; return; } - fclose(file); const QString filename = location + QStringLiteral("/session.json"); - file = fopen(qPrintable(filename), "rb"); + FILE *file = fopen(qPrintable(filename), "rb"); if (!file) { qCWarning (lcDebugTrace) << "unable to open session file: " << filename; m_location = location; |