Project

General

Profile

Bug #1760

Bug #1450: Illumos should be buildable with GCC4

constant condition in elfsign annoys GCC

Added by Rich Lowe almost 8 years ago. Updated almost 8 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
tools - gate/build tools
Start date:
2011-11-10
Due date:
% Done:

100%

Estimated time:
Difficulty:
Bite-size
Tags:

Description

When requesting the DN when creating an elfsign certificate request, elfsign checks that the first argument of fgets(3C) has not become NULL. It can't. fgets returns NULL on error it doesn't, and can't, NULL the first argument.


diff --git a/usr/src/cmd/cmd-crypto/elfsign/elfsign.c b/usr/src/cmd/cmd-crypto/elfsign/elfsign.c
index 15f2788..45ae510 100644
--- a/usr/src/cmd/cmd-crypto/elfsign/elfsign.c
+++ b/usr/src/cmd/cmd-crypto/elfsign/elfsign.c
@@ -923,9 +923,7 @@ do_cert_request(char *object)
             "This will be the prefix of the Certificate DN: "));
         break;
     }
-
-    (void) fgets(cn, sizeof (cn), stdin);
-    if ((cn == NULL) || (cn[0] == '\n')) {
+    if ((fgets(cn, sizeof (cn), stdin) == NULL) || (cn[0] == '\n')) {
         es_error(gettext("you must specify a Certificate DN prefix"));
         return (EXIT_INVALID_ARG);
     }

History

#1

Updated by Rich Lowe almost 8 years ago

  • Status changed from In Progress to Resolved
  • % Done changed from 0 to 100
  • Difficulty changed from Medium to Bite-size

Resolved in r13517 commit:86bdede5c41c

Also available in: Atom PDF