~lightdm-team/lightdm/1.4

« back to all changes in this revision

Viewing changes to liblightdm-gobject/system.c

  • Committer: Robert Ancell
  • Date: 2014-03-13 02:15:38 UTC
  • Revision ID: robert.ancell@canonical.com-20140313021538-u2mxfxrrfw5u58ic
Tags: 1.4.7
Releasing 1.4.7

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2010-2011 Robert Ancell.
 
3
 * Author: Robert Ancell <robert.ancell@canonical.com>
 
4
 *
 
5
 * This library is free software; you can redistribute it and/or modify it under
 
6
 * the terms of the GNU Lesser General Public License as published by the Free
 
7
 * Software Foundation; either version 3 of the License, or (at your option) any
 
8
 * later version. See http://www.gnu.org/copyleft/lgpl.html the full text of the
 
9
 * license.
 
10
 */
 
11
 
 
12
#include <sys/utsname.h>
 
13
 
 
14
#include "lightdm/system.h"
 
15
 
 
16
static gchar *hostname = NULL;
 
17
 
 
18
/**
 
19
 * lightdm_get_hostname:
 
20
 *
 
21
 * Return value: The name of the host we are running on.
 
22
 **/
 
23
const gchar *
 
24
lightdm_get_hostname (void)
 
25
{
 
26
    if (!hostname)
 
27
    {
 
28
        struct utsname info;
 
29
        uname (&info);
 
30
        hostname = g_strdup (info.nodename);
 
31
    }
 
32
 
 
33
    return hostname;
 
34
}