aboutsummaryrefslogtreecommitdiffhomepage
path: root/notmuch-config.c
diff options
context:
space:
mode:
authorGravatar Mark Oteiza <mvoteiza@udel.edu>2014-07-20 23:06:28 -0400
committerGravatar David Bremner <david@tethera.net>2014-07-31 07:13:14 -0300
commit488b2619643de6776e2649d97b480da8db049023 (patch)
tree14d5dc9374bc332d44de9faa8a98bfd1cb508486 /notmuch-config.c
parenta5a47dab8776cffc6ffbd77c51933831a34279f1 (diff)
config: read user.name from $NAME if set
Try to read the config parameter user.name from $NAME before taking the user name from /etc/passwd.
Diffstat (limited to 'notmuch-config.c')
-rw-r--r--notmuch-config.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/notmuch-config.c b/notmuch-config.c
index 4886d366..8f1f48d0 100644
--- a/notmuch-config.c
+++ b/notmuch-config.c
@@ -219,7 +219,8 @@ get_username_from_passwd_file (void *ctx)
*
* database_path: $HOME/mail
*
- * user_name: From /etc/passwd
+ * user_name: $NAME variable if set, otherwise
+ * read from /etc/passwd
*
* user_primary_mail: $EMAIL variable if set, otherwise
* constructed from the username and
@@ -329,7 +330,9 @@ notmuch_config_open (void *ctx,
}
if (notmuch_config_get_user_name (config) == NULL) {
- char *name = get_name_from_passwd_file (config);
+ char *name = getenv ("NAME");
+ if (! name)
+ name = get_name_from_passwd_file (config);
notmuch_config_set_user_name (config, name);
talloc_free (name);
}