[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.
This commit is contained in:
parent
862b7e34df
commit
4621937477
@ -61,9 +61,8 @@ SetHostNameJob::prettyStatusMessage() const
|
|||||||
STATICTEST bool
|
STATICTEST bool
|
||||||
setFileHostname( const QString& hostname )
|
setFileHostname( const QString& hostname )
|
||||||
{
|
{
|
||||||
return !( CalamaresUtils::System::instance()
|
return CalamaresUtils::System::instance()->createTargetFile( QStringLiteral( "/etc/hostname" ),
|
||||||
->createTargetFile( QStringLiteral( "/etc/hostname" ), ( hostname + '\n' ).toUtf8() )
|
( hostname + '\n' ).toUtf8() );
|
||||||
.failed() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
STATICTEST bool
|
STATICTEST bool
|
||||||
@ -78,9 +77,8 @@ ff02::1 ip6-allnodes
|
|||||||
ff02::2 ip6-allrouters
|
ff02::2 ip6-allrouters
|
||||||
)";
|
)";
|
||||||
|
|
||||||
return !( CalamaresUtils::System::instance()
|
return CalamaresUtils::System::instance()->createTargetFile( QStringLiteral( "/etc/hosts" ),
|
||||||
->createTargetFile( QStringLiteral( "/etc/hosts" ), QString( etc_hosts ).arg( hostname ).toUtf8() )
|
QString( etc_hosts ).arg( hostname ).toUtf8() );
|
||||||
.failed() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
STATICTEST bool
|
STATICTEST bool
|
||||||
|
Loading…
Reference in New Issue
Block a user