[balsa] Assert that getpwuid returns a valid structure
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa] Assert that getpwuid returns a valid structure
- Date: Mon, 26 Jun 2017 22:39:20 +0000 (UTC)
commit 2132973b6a5ebb3bf27fa12385b723544d8b908f
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Mon Jun 26 18:35:20 2017 -0400
Assert that getpwuid returns a valid structure
* libbalsa/rfc3156.c (gpg_updates_trustdb): Assert that
getpwuid returns a valid passwd structure.
libbalsa/rfc3156.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/libbalsa/rfc3156.c b/libbalsa/rfc3156.c
index 59527dc..fe94f8e 100644
--- a/libbalsa/rfc3156.c
+++ b/libbalsa/rfc3156.c
@@ -1035,12 +1035,17 @@ gpg_updates_trustdb(void)
struct passwd *pwent;
struct stat stat_buf;
- if (!lockname)
- if ((pwent = getpwuid(getuid())))
+ if (lockname == NULL) {
+ if ((pwent = getpwuid(getuid())) != NULL) {
lockname =
g_strdup_printf("%s/.gnupg/trustdb.gpg.lock",
pwent->pw_dir);
- if (!stat(lockname, &stat_buf)) {
+ } else {
+ g_assert_not_reached();
+ }
+ }
+
+ if (stat(lockname, &stat_buf) == 0) {
libbalsa_information(LIBBALSA_INFORMATION_ERROR, "%s%s",
_
("GnuPG is rebuilding the trust database and is currently unavailable."),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]