Commits

Alex Hixon committed f40ecd3

Correctly check return code when trying to load files in the system ucode path.

Also, spew where we looked when we fail.

Comments (0)

Files changed (1)

     
     loader_msg ("Found camera: %04x:%04x\n", dev->descriptor.idVendor,
         dev->descriptor.idProduct);
-    //loader_msg ("Firmware: %s\n\n", firmware);
     
     // Open the firmware file
-    if ((fd = g_open (firmware, O_RDONLY)) != -1) {
+    if ((fd = g_open (firmware, O_RDONLY)) < 0) {
         #ifdef UCODE_PATH
         firmware = usb_id_printf (UCODE_PATH, dev);
-        //loader_msg ("Trying %s\n", firmware);
-        if ((fd = g_open (firmware, O_RDONLY)) == -1) {
+        if ((fd = g_open (firmware, O_RDONLY)) < 0) {
             loader_error ("Failed to open %s. Does it exist?\n", firmware);
         }
         #else
     // Possibly not the best way to do this, but hey, it's certainly easy
     // (without loading everything into memory, and compared to seeking around)
     if (stat (firmware, &infobuf) == -1) {
-        loader_error ("Failed to get filesize of firmware.\n");
+        loader_error ("Failed to get filesize of firmware (%s).\n", firmware);
     }
     
     // Try the USB device too.