OSDN Git Service

Merge remote-tracking branch 'origin/abt/topic/gmin/l-dev/sensors/master' into mr1
[android-x86/hardware-intel-libsensors.git] / accel-calibration.c
index 8a21a05..9367774 100644 (file)
@@ -201,7 +201,8 @@ void accel_cal_store (int s)
 
        fd = open(ACCEL_CALIBRATION_PATH, O_WRONLY | O_TRUNC | O_CREAT, S_IRUSR);
 
-       write(fd, cal_data, sizeof(accel_cal_t));
-
-       close(fd);
+       if (fd != -1) {
+               write(fd, cal_data, sizeof(accel_cal_t));
+               close(fd);
+       }
 }