Merge pull request #74 from TitanMKD/master

Fix management hackrf_spiflash invalid filename or error to open for read/write
This commit is contained in:
Michael Ossmann
2013-06-07 20:31:44 -07:00

View File

@ -158,6 +158,11 @@ int main(int argc, char** argv)
if( write ) if( write )
{ {
fd = fopen(path, "rb"); fd = fopen(path, "rb");
if(fd == NULL)
{
printf("Error to open file %s\n", path);
return EXIT_FAILURE;
}
/* Get size of the file */ /* Get size of the file */
fseek(fd, 0, SEEK_END); /* Not really portable but work on major OS Linux/Win32 */ fseek(fd, 0, SEEK_END); /* Not really portable but work on major OS Linux/Win32 */
length = ftell(fd); length = ftell(fd);
@ -185,6 +190,11 @@ int main(int argc, char** argv)
if (read) { if (read) {
fd = fopen(path, "wb"); fd = fopen(path, "wb");
if(fd == NULL)
{
printf("Error to open file %s\n", path);
return EXIT_FAILURE;
}
} }
if (fd == NULL) { if (fd == NULL) {