SD library - faulty error returns?

I'm using an Uno to record data to an SD card. The SD shield in use is the one available at Radio Shack.

It seemed to me that it would be appropriate to include some error indications, so I created some LED blink patterns that would be invoked if the SD card were missing or if a file descriptor was not returned. That is, if the begin() fails (indicating a missing SD card), a flag is set, and in the loop the main program is disabled and the card only blinks its LED to indicate the failure. The open() is programmed similarly.

The problem is that I discovered that the LED doesn't blink its error pattern if the Uno is powered up without an SD card.

After some testing, I discovered that both the begin() and the open() can cause the LED pattern not to blink.

The sketch works fine if there is an SD card in the slot.

So I'd suggest that error returns perhaps have not been fully programmed in the SD library. Is this library open source? If so, I'd be happy to fix it myself. If not, I would ask that the author fix it. Thank you.

(I make it a practice to have an LED blink pattern at power-up time, to identify which sketch is loaded. That also fails to work when the others do.)

Are you using the onboard pin 13 LED? If so, you can't use that pin with an Uno and the SPI bus. The SD card is SPI.

Read this before posting a programming question

Where is this code?

The SD card source is part of the distribution (the libraries folder).

Is this library open source? If so, I’d be happy to fix it myself.

Sure it is. (GPL)

And it behaves crappy if you plan to remove the SD card temporarily…

My solution was to call SD.begin() before each SD card action , and to wait and repeat that after a while,
if it returns false.

boolean SDClass::begin(uint8_t csPin) {
  /*
    Performs the initialisation required by the sdfatlib library.
    Return true if initialization succeeds, false otherwise.
	MOD: Can be called multiple times ( whenever you suspect the card was removed )
   */
  if (root.isOpen()) root.close(); // MOD : to allow another begin any time later
  return card.init(SPI_HALF_SPEED, csPin) &&
         volume.init(card) &&
         root.openRoot(volume);
}