Fix -Werror=format-truncation on GCC 7

Fix formatting

Check snprintf return for error AND overflow
This commit is contained in:
Julien Lecoeur
2017-06-26 15:50:44 +02:00
committed by Julian Oes
parent 407b403e68
commit 7929287f73
6 changed files with 64 additions and 34 deletions
+7 -4
View File
@@ -718,7 +718,8 @@ PWMSim::pwm_ioctl(device::file_t *filp, int cmd, unsigned long arg)
ret = -EINVAL;
break;
}
/* FALLTHROUGH */
/* FALLTHROUGH */
case PWM_SERVO_SET(0):
case PWM_SERVO_SET(1):
@@ -740,7 +741,8 @@ PWMSim::pwm_ioctl(device::file_t *filp, int cmd, unsigned long arg)
ret = -EINVAL;
break;
}
/* FALLTHROUGH */
/* FALLTHROUGH */
case PWM_SERVO_GET(3):
case PWM_SERVO_GET(2):
@@ -748,8 +750,9 @@ PWMSim::pwm_ioctl(device::file_t *filp, int cmd, unsigned long arg)
ret = -EINVAL;
break;
}
/* FALLTHROUGH */
/* FALLTHROUGH */
case PWM_SERVO_GET(1):
case PWM_SERVO_GET(0): {
*(servo_position_t *)arg = 1500;