kinit: fix 13c8a2c2124ba1a9af53e64304d4ca9b1e809dbc
authorJeffrey Altman <jaltman@secure-endpoints.com>
Mon, 24 Apr 2017 21:41:35 +0000 (17:41 -0400)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Mon, 24 Apr 2017 21:46:52 +0000 (17:46 -0400)
In 13c8a2c2124ba1a9af53e64304d4ca9b1e809dbc permits fclose() to
be issued on 'stdin' and forgets to use the N_() macro for text
strings.

Change-Id: I5e9ac1354da8dcff5277c39e4784a768ad76afdd

kuser/kinit.c

index 4e93c6905231fcc3ac42ed83a2b9f3d55724131a..174c4fe3c15b5c1f92c176b0062eb28b4ef680e5 100644 (file)
@@ -460,7 +460,7 @@ get_new_tickets(krb5_context context,
        else
            f = fopen(password_file, "r");
        if (f == NULL) {
-           krb5_warnx(context, "Failed to open the password file %s",
+           krb5_warnx(context, N_("Failed to open the password file %s", ""),
                       password_file);
            return errno;
        }
@@ -468,7 +468,8 @@ get_new_tickets(krb5_context context,
        if (fgets(passwd, sizeof(passwd), f) == NULL) {
            krb5_warnx(context, N_("Failed to read password from file %s", ""),
                       password_file);
-           fclose(f);
+           if (f != stdin)
+               fclose(f);
            return EINVAL; /* XXX Need a better error */
        }
        if (f != stdin)