- fix: avoid calling getpass twice as side effect of xstrdup macro (#17672).
authorjbj <devnull@localhost>
Tue, 26 Sep 2000 22:28:09 +0000 (22:28 +0000)
committerjbj <devnull@localhost>
Tue, 26 Sep 2000 22:28:09 +0000 (22:28 +0000)
CVS patchset: 4179
CVS date: 2000/09/26 22:28:09

rpmio/url.c

index 5a264b4..cbf1aaf 100644 (file)
@@ -221,7 +221,9 @@ static void urlFind(urlinfo *uret, int mustAsk)
            prompt = alloca(strlen(u->host) + strlen(u->user) + 256);
            sprintf(prompt, _("Password for %s@%s: "), u->user, u->host);
            if (u->password)    xfree(u->password);
-           u->password = xstrdup( /*@-unrecog@*/ getpass(prompt) /*@=unrecog@*/ );
+           /* XXX xstrdup has side effects. */
+           u->password = /*@-unrecog@*/ getpass(prompt) /*@=unrecog@*/;
+           u->password = xstrdup(u->password);
        }
 
        if (u->proxyh == NULL) {