summaryrefslogtreecommitdiffstats
path: root/modsign.cxx
diff options
context:
space:
mode:
authorDave Brolley <brolley@redhat.com>2009-05-05 14:49:06 -0400
committerDave Brolley <brolley@redhat.com>2009-05-05 14:49:06 -0400
commit2a5b3e3fe4e87a9b25286358f280b67791816e0a (patch)
treefc71c9626491be6da210285caec7eb57456a9e00 /modsign.cxx
parent04cba3b870c1fed6ce8f62e3eb0288a7f1abd071 (diff)
downloadsystemtap-steved-2a5b3e3fe4e87a9b25286358f280b67791816e0a.tar.gz
systemtap-steved-2a5b3e3fe4e87a9b25286358f280b67791816e0a.tar.xz
systemtap-steved-2a5b3e3fe4e87a9b25286358f280b67791816e0a.zip
Ensure that pw is not used if it is NULL.
Diffstat (limited to 'modsign.cxx')
-rw-r--r--modsign.cxx20
1 files 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;
}