From 2a5b3e3fe4e87a9b25286358f280b67791816e0a Mon Sep 17 00:00:00 2001 From: Dave Brolley Date: Tue, 5 May 2009 14:49:06 -0400 Subject: Ensure that pw is not used if it is NULL. --- modsign.cxx | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/modsign.cxx b/modsign.cxx index e7d02fba..8f29dab1 100644 --- a/modsign.cxx +++ b/modsign.cxx @@ -221,19 +221,17 @@ check_cert_db_permissions (const string &cert_db_path) { // We must be the owner of the database. euid = geteuid (); pw = getpwuid (euid); + if (! pw) + { + cerr << "Unable to obtain current user information which checking certificate database " + << cert_db_path << endl; + perror (""); + return 0; + } if (info.st_uid != euid) { - if (pw) - { - cerr << "Certificate database " << cert_db_path << " must be owned by " - << pw->pw_name << endl; - } - else - { - cerr << "Unable to obtain current user information which checking certificate database " - << cert_db_path << endl; - perror (""); - } + cerr << "Certificate database " << cert_db_path << " must be owned by " + << pw->pw_name << endl; rc = 0; } -- cgit