]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
Log warning when changing file ownership fails
authorBill Unruh <unruh@physics.ubc.ca>
Sun, 20 Dec 2009 11:23:02 +0000 (12:23 +0100)
committerMiroslav Lichvar <mlichvar@redhat.com>
Sun, 20 Dec 2009 11:29:24 +0000 (12:29 +0100)
reference.c
rtc_linux.c

index 164809ddeeb7984b1a26c0f98bba9b022b17feda..93df9c5b5311e7e5d2ebfd8c5e7050d7e7909c9a 100644 (file)
@@ -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);
   }
 
index bd7d1075f7c2b14e73eee90b37fb71e673976a97..582a8b5cea7b72144fe1d498a0fd34db551a9135 100644 (file)
@@ -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);
   }