=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ssh/ssh-add.c,v retrieving revision 1.112 retrieving revision 1.113 diff -u -r1.112 -r1.113 --- src/usr.bin/ssh/ssh-add.c 2014/07/03 03:15:01 1.112 +++ src/usr.bin/ssh/ssh-add.c 2014/07/09 14:15:56 1.113 @@ -1,4 +1,4 @@ -/* $OpenBSD: ssh-add.c,v 1.112 2014/07/03 03:15:01 djm Exp $ */ +/* $OpenBSD: ssh-add.c,v 1.113 2014/07/09 14:15:56 benno Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -199,8 +199,6 @@ if ((r = sshkey_parse_private_fileblob(&keyblob, "", filename, &private, &comment)) != 0 && r != SSH_ERR_KEY_WRONG_PASSPHRASE) fatal("Cannot parse %s: %s", filename, ssh_err(r)); - if (comment == NULL) - comment = xstrdup(filename); /* try last */ if (private == NULL && pass != NULL) { if ((r = sshkey_parse_private_fileblob(&keyblob, pass, filename, @@ -208,6 +206,8 @@ r != SSH_ERR_KEY_WRONG_PASSPHRASE) fatal("Cannot parse %s: %s", filename, ssh_err(r)); } + if (comment == NULL) + comment = xstrdup(filename); if (private == NULL) { /* clear passphrase since it did not work */ clear_pass();