D21650: Shorten sockets file path

David Faure noreply at phabricator.kde.org
Tue Jun 11 09:40:48 BST 2019


dfaure requested changes to this revision.
dfaure added inline comments.
This revision now requires changes to proceed.

INLINE COMMENTS

> utils.cpp:72
> +
> +        if (socketDir.length() > static_cast<int>(sizeof(sockaddr_un::sun_path))) {
> +            qCWarning(AKONADISERVER_LOG) << "akonadiSocketDirectory() length is too long to be used by the system, fallbacking to the default directory.";

should be >=, you need room for the trailing NUL character as well.

> utils.cpp:74
> +            qCWarning(AKONADISERVER_LOG) << "akonadiSocketDirectory() length is too long to be used by the system, fallbacking to the default directory.";
> +            socketDir = defaultDirectory;
> +        }

Let's hope that one does fit in the length limit :-)

> utils.cpp:111
> +    const QString identifier = Instance::hasIdentifier() ? Instance::identifier() : QLatin1String("default");
> +    const QString link = StandardDirs::saveDir("data") + QDir::separator() + QStringLiteral("socket-%1-%2").arg(hostname, identifier);
>  

Don't use QDir::separator(). That's '\' on Windows, while all this code uses '/' everywhere.

Just make it "/socket..." (the existing code is the result of automated conversion)

> utils.cpp:150
>  {
> -    QString directory = QStringLiteral("%1%2%3").arg(QDir::tempPath()).arg(QDir::separator()).arg(tmpl);
> +    const QString directory = QStringLiteral("%1%3%2").arg(StandardDirs::saveDir("runtime"), identifier).arg(QDir::separator());
>  

%1/%2, no need for QDir::separator, this uses Qt APIs, not native APIs.

REPOSITORY
  R165 Akonadi

REVISION DETAIL
  https://phabricator.kde.org/D21650

To: fazevedo, dfaure, dvratil
Cc: kde-pim, dvasin, rodsevich, winterz, vkrause, mlaurent, knauss, dvratil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20190611/604f46e9/attachment-0001.html>


More information about the kde-pim mailing list