From 462193747772fc8547578c16706ea534342c0f15 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 24 Feb 2020 12:44:50 +0100 Subject: [PATCH] [users] Use right check on writing hostname - !failed() also means "didn't write the file because it already exists", which is sometimes acceptable -- but not here. Use the more-strict bool() conversion, which is only when the file was actually written. --- src/modules/users/SetHostNameJob.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/modules/users/SetHostNameJob.cpp b/src/modules/users/SetHostNameJob.cpp index db220d042..1c70fe634 100644 --- a/src/modules/users/SetHostNameJob.cpp +++ b/src/modules/users/SetHostNameJob.cpp @@ -61,9 +61,8 @@ SetHostNameJob::prettyStatusMessage() const STATICTEST bool setFileHostname( const QString& hostname ) { - return !( CalamaresUtils::System::instance() - ->createTargetFile( QStringLiteral( "/etc/hostname" ), ( hostname + '\n' ).toUtf8() ) - .failed() ); + return CalamaresUtils::System::instance()->createTargetFile( QStringLiteral( "/etc/hostname" ), + ( hostname + '\n' ).toUtf8() ); } STATICTEST bool @@ -78,9 +77,8 @@ ff02::1 ip6-allnodes ff02::2 ip6-allrouters )"; - return !( CalamaresUtils::System::instance() - ->createTargetFile( QStringLiteral( "/etc/hosts" ), QString( etc_hosts ).arg( hostname ).toUtf8() ) - .failed() ); + return CalamaresUtils::System::instance()->createTargetFile( QStringLiteral( "/etc/hosts" ), + QString( etc_hosts ).arg( hostname ).toUtf8() ); } STATICTEST bool