Private
Public Access
2
0

pwm: fixed wrong line ending being checked by strtol

Move from fopen to POSIX open introduced this bug in strtol

Signed-off-by: Maximilian von Tschirschnitz <maximilian.tschirschnitz@intel.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
Maximilian von Tschirschnitz
2014-10-29 13:52:49 +01:00
committed by Brendan Le Foll
parent e5c3e491a8
commit a202b3fd17

View File

@@ -104,7 +104,7 @@ mraa_pwm_read_period(mraa_pwm_context dev)
char *endptr;
long int ret = strtol(output, &endptr, 10);
if ('\0' != *endptr) {
if ('\0' != *endptr && '\n' != *endptr) {
syslog(LOG_ERR, "pwm: Error in string converstion");
return -1;
}
@@ -130,7 +130,7 @@ mraa_pwm_read_duty(mraa_pwm_context dev)
char *endptr;
long int ret = strtol(output, &endptr, 10);
if ('\0' != *endptr) {
if ('\0' != *endptr && '\n' != *endptr) {
syslog(LOG_ERR, "pwm: Error in string converstion");
return -1;
}