config: read user.name from $NAME if set
authorMark Oteiza <mvoteiza@udel.edu>
Mon, 21 Jul 2014 03:06:28 +0000 (23:06 -0400)
committerDavid Bremner <david@tethera.net>
Thu, 31 Jul 2014 10:13:14 +0000 (07:13 -0300)
Try to read the config parameter user.name from $NAME before taking the
user name from /etc/passwd.

notmuch-config.c

index 4886d366f7e787af9d6ffbc6dc8a92efb73c2628..8f1f48d07b51301a0f08be1a39b7ab6beb3ba7f1 100644 (file)
@@ -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);
     }