mirror of
https://github.com/parchlinux/calamares.git
synced 2025-02-24 10:55:46 -05:00
[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
1 changed files with 4 additions and 6 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue