vslavik / poedit

Translations editor for Mac, Windows and Unix
https://poedit.net
MIT License
1.8k stars 279 forks source link

Fix chmod/chown return code verification logic #772

Closed super7ramp closed 2 years ago

super7ramp commented 2 years ago

On Linux, TempOutputFileFor::ReplaceFile returns a wrong status, indicating the replacement has failed when it has not. This leads to a misleading error message displayed to user on every po file save.

The cause is in the verification of the return codes of chown/chmod. chown and chmod return a non-zero integer value when an error occurs. A non-zero value is considered as a boolean true.

This commit fixes the logic error; It explicitly compares the returned integer value to another integer to avoid confusion.

vslavik commented 2 years ago

Introduced in 91c5f13257ffed9b80dc6744546f9cd25a2725ae :(

Thanks, this is serious enough to warrant immediate 3.2.1