~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/config.py

  • Committer: Patch Queue Manager
  • Date: 2012-07-24 13:25:42 UTC
  • mfrom: (6538.4.6 mailname-first-line)
  • Revision ID: pqm@pqm.ubuntu.com-20120724132542-5e7aakd1c3t9oggf
(jelmer) Only read the first line from /etc/mailname. (Haw Loeung)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1562
1562
        return os.path.expanduser('~/.cache')
1563
1563
 
1564
1564
 
1565
 
def _get_default_mail_domain():
 
1565
def _get_default_mail_domain(mailname_file='/etc/mailname'):
1566
1566
    """If possible, return the assumed default email domain.
1567
1567
 
1568
1568
    :returns: string mail domain, or None.
1571
1571
        # No implementation yet; patches welcome
1572
1572
        return None
1573
1573
    try:
1574
 
        f = open('/etc/mailname')
 
1574
        f = open(mailname_file)
1575
1575
    except (IOError, OSError), e:
1576
1576
        return None
1577
1577
    try:
1578
 
        domain = f.read().strip()
 
1578
        domain = f.readline().strip()
1579
1579
        return domain
1580
1580
    finally:
1581
1581
        f.close()