agent: Do not overwrite a key file by a shadow key file.
* agent/findkey.c (agent_write_private_key): Partly rewrite to align with 2.2 code and to make sure that we don't overwrite a real key. (is_shadowed_key): New.
This change is now also needed in 2.4 due to the the former change
"Create and use Token entries to track the display s/n".
- GnuPG-bug-id: T6386