diff options
| author | Aleix Pol <aleixpol@kde.org> | 2021-09-07 03:57:06 +0200 | 
|---|---|---|
| committer | David Faure <faure@kde.org> | 2021-09-19 22:54:25 +0000 | 
| commit | 3090534d92d598c4f6a1d758cc4392aa086a4c0a (patch) | |
| tree | 35245d18a0d487db71797df69d52a117400a20b8 /src | |
| parent | 0b0a4464fb3d1145eb612b1ab7edacfa9581c8c9 (diff) | |
| download | kconfig-3090534d92d598c4f6a1d758cc4392aa086a4c0a.tar.gz kconfig-3090534d92d598c4f6a1d758cc4392aa086a4c0a.tar.bz2 | |
kconfigini: Only open the file once to write
We were calling open(), then fopen(), then QFile::open(). This patch
removes the fopen() call that does not seem to do anything.
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/kconfigini.cpp | 11 | 
1 files changed, 3 insertions, 8 deletions
| diff --git a/src/core/kconfigini.cpp b/src/core/kconfigini.cpp index 7c1e15f0..0e85cda7 100644 --- a/src/core/kconfigini.cpp +++ b/src/core/kconfigini.cpp @@ -510,19 +510,14 @@ bool KConfigIniBackend::writeConfig(const QByteArray &locale, KEntryMap &entryMa          if (fd < 0) {              return false;          } -        FILE *fp = ::fdopen(fd, "w"); -        if (!fp) { -            QT_CLOSE(fd); -            return false; -        }          QFile f; -        if (!f.open(fp, QIODevice::WriteOnly)) { -            fclose(fp); +        if (!f.open(fd, QIODevice::WriteOnly)) { +            QT_CLOSE(fd);              return false;          }          writeEntries(locale, f, writeMap);          f.close(); -        fclose(fp); +        QT_CLOSE(fd);  #else          QFile f(filePath());          // XXX This is broken - it DOES create the file if it is suddenly gone. | 
