OSDN Git Service
(root)
/
android-x86
/
hardware-intel-libsensors.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
87a01bc
)
Fix potentially improper fd usage
author
Patrick Porlan
<patrick.porlan@intel.com>
Wed, 4 Mar 2015 08:57:38 +0000
(09:57 +0100)
committer
Adriana Reus
<adriana.reus@intel.com>
Mon, 9 Mar 2015 10:14:29 +0000
(12:14 +0200)
Check for -1 after open
Change-Id: Icd29828a05f32155bc1a58432492976d5a6ad70b
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
accel-calibration.c
patch
|
blob
|
history
diff --git
a/accel-calibration.c
b/accel-calibration.c
index
8a21a05
..
9367774
100644
(file)
--- a/
accel-calibration.c
+++ b/
accel-calibration.c
@@
-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);
+ }
}