diff --git a/src/systemcmds/tests/test_servo.c b/src/systemcmds/tests/test_servo.c index a8a75b7a8e..70ca16ecd2 100644 --- a/src/systemcmds/tests/test_servo.c +++ b/src/systemcmds/tests/test_servo.c @@ -116,6 +116,8 @@ int test_servo(int argc, char *argv[]) printf("Advancing channel 1 to 1800\n"); result = ioctl(fd, PWM_SERVO_SET(1), 1800); out: - close(fd); + if (fd >= 0) { + close(fd); + } return 0; }