mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-04 00:15:07 -05:00
Check return value of chmod() and fcntl()
This commit is contained in:
@@ -359,10 +359,12 @@ update_drift_file(double freq_ppm, double skew)
|
||||
/* Clone the file attributes from the existing file if there is one. */
|
||||
|
||||
if (!stat(drift_file,&buf)) {
|
||||
if (chown(temp_drift_file,buf.st_uid,buf.st_gid)) {
|
||||
LOG(LOGS_WARN, LOGF_Reference, "Could not change ownership of temporary driftfile %s.tmp", drift_file);
|
||||
if (chown(temp_drift_file,buf.st_uid,buf.st_gid) ||
|
||||
chmod(temp_drift_file,buf.st_mode & 0777)) {
|
||||
LOG(LOGS_WARN, LOGF_Reference,
|
||||
"Could not change ownership or permissions of temporary driftfile %s.tmp",
|
||||
drift_file);
|
||||
}
|
||||
chmod(temp_drift_file,buf.st_mode&0777);
|
||||
}
|
||||
|
||||
/* Rename the temporary file to the correct location (see rename(2) for details). */
|
||||
|
||||
Reference in New Issue
Block a user