Safely call hackrf_close() after resetting the HackRF

This commit is contained in:
Dominic Spill
2017-01-27 16:08:57 -07:00
parent 9e78ccb4e7
commit da743b84ef

View File

@ -313,15 +313,15 @@ int main(int argc, char** argv)
fd = NULL; fd = NULL;
return EXIT_FAILURE; return EXIT_FAILURE;
} }
} else { }
result = hackrf_close(device);
if (result != HACKRF_SUCCESS) { result = hackrf_close(device);
fprintf(stderr, "hackrf_close() failed: %s (%d)\n", if (result != HACKRF_SUCCESS) {
hackrf_error_name(result), result); fprintf(stderr, "hackrf_close() failed: %s (%d)\n",
fclose(fd); hackrf_error_name(result), result);
fd = NULL; fclose(fd);
return EXIT_FAILURE; fd = NULL;
} return EXIT_FAILURE;
} }
hackrf_exit(); hackrf_exit();