From 4a9205b341d2be3c6f5b92194025dd790b34cbd9 Mon Sep 17 00:00:00 2001 From: Bill Unruh Date: Sun, 20 Dec 2009 12:23:02 +0100 Subject: [PATCH] Log warning when changing file ownership fails --- reference.c | 4 +++- rtc_linux.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/reference.c b/reference.c index 164809d..93df9c5 100644 --- a/reference.c +++ b/reference.c @@ -246,7 +246,9 @@ 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)) { - chown(temp_drift_file,buf.st_uid,buf.st_gid); + 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); + } chmod(temp_drift_file,buf.st_mode&0777); } diff --git a/rtc_linux.c b/rtc_linux.c index bd7d107..582a8b5 100644 --- a/rtc_linux.c +++ b/rtc_linux.c @@ -511,7 +511,9 @@ 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)) { - chown(temp_coefs_file_name,buf.st_uid,buf.st_gid); + 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); + } chmod(temp_coefs_file_name,buf.st_mode&0777); }