Commit 97e4c9c8ce2ba90fc2f0f989d775a1667d6c4aab

Authored by Tim Gover
1 parent b3f379cf

usbboot: Indicate when a file is missing / empty.

Indicate when a file is emtpy or missing because this is normally
due to a script / symlink issue rather than the file being
intentionally blank.
Showing 1 changed file with 6 additions and 2 deletions
... ... @@ -587,7 +587,8 @@ int file_server(libusb_device_handle * usb_device)
587 587 file_size = ftell(fp);
588 588 fseek(fp, 0, SEEK_SET);
589 589  
590   - if(verbose) printf("File size = %d bytes\n", file_size);
  590 + if(verbose || !file_size)
  591 + printf("File size = %d bytes\n", file_size);
591 592  
592 593 int sz = libusb_control_transfer(usb_device, LIBUSB_REQUEST_TYPE_VENDOR, 0,
593 594 file_size & 0xffff, file_size >> 16, NULL, 0, 1000);
... ... @@ -598,7 +599,7 @@ int file_server(libusb_device_handle * usb_device)
598 599 else
599 600 {
600 601 ep_write(NULL, 0, usb_device);
601   - if(verbose) printf("Cannot open file %s\n", message.fname);
  602 + printf("Cannot open file %s\n", message.fname);
602 603 break;
603 604 }
604 605 break;
... ... @@ -615,6 +616,9 @@ int file_server(libusb_device_handle * usb_device)
615 616 file_size = ftell(fp);
616 617 fseek(fp, 0, SEEK_SET);
617 618  
  619 + if (!file_size)
  620 + printf("WARNING: %s is empty\n", message.fname);
  621 +
618 622 buf = malloc(file_size);
619 623 if(buf == NULL)
620 624 {
... ...