mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 16:25:07 -05:00
Check return value of chmod() and fcntl()
This commit is contained in:
@@ -508,10 +508,12 @@ write_coefs_to_file(int valid,time_t ref_time,double offset,double rate)
|
||||
/* Clone the file attributes from the existing file if there is one. */
|
||||
|
||||
if (!stat(coefs_file_name,&buf)) {
|
||||
if (chown(temp_coefs_file_name,buf.st_uid,buf.st_gid)) {
|
||||
LOG(LOGS_WARN, LOGF_RtcLinux, "Could not change ownership of temporary RTC file %s.tmp", coefs_file_name);
|
||||
if (chown(temp_coefs_file_name,buf.st_uid,buf.st_gid) ||
|
||||
chmod(temp_coefs_file_name,buf.st_mode & 0777)) {
|
||||
LOG(LOGS_WARN, LOGF_RtcLinux,
|
||||
"Could not change ownership or permissions of temporary RTC file %s.tmp",
|
||||
coefs_file_name);
|
||||
}
|
||||
chmod(temp_coefs_file_name,buf.st_mode&0777);
|
||||
}
|
||||
|
||||
/* Rename the temporary file to the correct location (see rename(2) for details). */
|
||||
|
||||
Reference in New Issue
Block a user